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

5 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by