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

4 views (last 30 days)
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);

Accepted Answer

Jon
Jon on 24 Apr 2018
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

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!