"Inputs must be scalars" error message whilst using linspace command

4 ビュー (過去 30 日間)
Reece Nasse
Reece Nasse 2018 年 4 月 24 日
編集済み: Reece Nasse 2018 年 4 月 24 日
Im trying to use the linspace command (in the form of x1,x2,n)on the second column of a previously created array, so that it creates vectors from the highest value to the lowest value but I keep getting an error message saying "inputs must be scalars". Here is the section of my code:
A=table2array(Data);
SSD = A(:,3)-SimulatedY.^2;
SSD = sum(SSD);
Xplot(icount,jcount,kcount) = i;
Yplot(icount,jcount,kcount) = j;
Tplot(icount,jcount,kcount) = k;
Zplot(icount,jcount, kcount) = SSD;
if SSD < MinimumSSD
MinimumSSD = SSD;
Bestparams1 = i;
Bestparams2 = j;
Bestparams3 = k;
end
end
end
end
figure
hold on
plot(A(:,1),A(:,3),'o') %plot actual data
a =linspace(min(A(:,2)):max(A(:,2)),30);

採用された回答

Jon
Jon 2018 年 4 月 24 日
your last line of code should be
a =linspace(min(A(:,2)), max(A(:,2)),30);
you had a colon separating min(A(:,2)) and max(A(:,2)) you need a comma

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by