この質問は、matlabを使用してデータをビニングすることについてです。私は2つのデータセットを持っています。 1つのデータセットでは、私はbininして平均std、edgeとhの値を計算したx(速度を表す)とy(電力を表す)値を持っています。 (ここではコードではこれは新しいデータです)、それらが属する特定のビン(ここでは、私はすべてここで与えられたコードで計算されます)。下のコードでは、newdataにbinと一致する新しいデータセットが含まれます。私は間違いを犯したり、それを修正して、私は次のエラーを取得していますどこに私を助けてください:誰も私が私のMATLABプログラミングで間違いを犯している私を助けることができますか?
Error using >
Matrix dimensions must agree.
Error in Binning_Online (line 23)
newdatabin=find(newdata>binEdges,1,'last'); %this is the bin number where the new data goes in
コード:他人として
x= load speed;
y= load power;
newdata= load new_speed;
topEdge = 20; % upper limit
botEdge = 5; % lower limit
numBins = 40; % define number of bins
[N,edges,bins] = histcounts(y_vector,numBins);
Pow_means = []; speed_means = [];
for n = 1:numBins;
Pow_means(n,1) = mean(x_vector(bins==n,1)); % for each bins mean value calculation.
speed_means(n,1) = mean(y_vector(bins==n,1)); % for each bins mean value calculation.
pow_std(n,1) = std(x_vector(bins==n,1)); % for Standard deviation calculation
binEdges = linspace(botEdge, topEdge, numBins+1);
newdatabin= find(newdata>binedges,1,'last'); %this is the bin number where the new data goes in
h(newdatabin)=h(newdatabin)+1;
end
問題は何ですか。 – user4759923
なぜエラーメッセージを書かないのですか? – giosans
@giosansこれは私が得るエラーです:エラーを使用して> マトリックスの寸法は一致している必要があります。 Binning_Online(行23)のエラー newdatabin = find(newdata> binEdges、1、 'last'); %これは新しいデータが入るビン番号です –