2
votes

I'm trying to do something relatively simple using plots in Matlab, but it is not working. In concept the idea is simple. As a simple example I tried this,

x = [1 2 3 4 5];
y = [1 2 3 4 5];

TColor1 = 'b';
TLine1 = '-';
plot(x,y,TLine1,TColor1)

I want to use predefined strings to change the properties of the plot. The color string works correctly, but the line string doesn't work. I don't understand the problem with the code.

The reason I need this functionality is I have big code where I output large amounts of plots inside several 'for' loops. I need to have the capability to change the plot properties outside the “for” loop.

1

1 Answers

3
votes

Just use

plot(x,y, [TLine1,TColor1])

(Note the square brackets.)