Why wont Matlab plot these two arrays?

clc;
fprintf('Please select the .txt file with your values\n');
pause(1);
clc;
fileName = uigetfile('*.txt');
load(fileName);
inputValues = load(fileName);
maxStress2 = zeros(1,size(inputValues,1));
for n = 1:size(inputValues,1)
maxStress2(1,n) = momentStress2(inputValues(n,1),inputValues(n,2), ...
inputValues(n,3),inputValues(n,4),inputValues(n,5),inputValues(n,6));
end
for n = 1:size(inputValues,1)
y = (maxStress2(n));
x = inputValues(n,n);
plot(x,y);
If I use disp(x) and disp(y) I get the values I want as the same size array... so why cant they be plotted?

 Accepted Answer

The plot call in the loop is most likely plotting one point at a time, but since you have not specified a marker for the point, they are not showing up.
Your best option is to eliminate the loop containing the plot call, and simply do this instead:
plot(maxStress2, inputValues)

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!