看板 MATLAB 關於我們 聯絡資訊
※ 引述《malaydam ()》之銘言: : 請問如何出現多組數據 : 如下例,應該出現四組spd,但執行只會出現一組 : 程式如下: : function [wavelength_spd, spd]=spectrum(a,b) : wavelength_spd=a(:,1); : y1=a(:,2); : y2=b(:,2); : range1=max(y1)-min(y1); : Ny1=(y1-min(y1))/range1; : range2=max(y2)-min(y2); : Ny2=(y2-min(y2))/range2; spd=bsxfun(@times, ndgrid(1:2,1:2), [Ny1, Ny2]) 顯示 Error using bsxfun Non-singleton dimensions of the two input arrays must match each other. 有甚麼地方錯誤嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.248.184.184 ※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1440600093.A.E6D.html
celestialgod: 囧 原來你的Ny1是向量= = 08/27 00:15
malaydam: 對啊!Ny1及Ny2是100x1的矩陣 08/27 00:36
celestialgod: 改成cell存,或是三維矩陣 08/27 08:58