Ashutosh Singla
Ashutosh Singla

Reputation: 739

Plotting the cell array in MATLAB

I have two 1-D cell arrays with numbers inside, how can I plot this?

X = {'1' '2' '35' }
Y = {'23' '30' '90' }

I am trying to plot the two cell arrays using plot command:

plot (X,Y);

And I received the following the error:

Not enough input arguments. 

Any suggestions?

Upvotes: 0

Views: 95

Answers (1)

Suever
Suever

Reputation: 65430

You need to first convert your cell arrays of strings to an array of numbers. You can do this using str2double

X = {'1' '2' '35' }
Y = {'23' '30' '90' }

plot(str2double(X), str2double(Y))

enter image description here

Upvotes: 4

Related Questions