Grady F. Mathews Iv
Grady F. Mathews Iv

Reputation: 187

Matlab plot functionality

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.

Upvotes: 2

Views: 85

Answers (1)

H.Muster
H.Muster

Reputation: 9317

Just use

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

(Note the square brackets.)

Upvotes: 3

Related Questions