MATLAB: How to fix : invalid first data argument

invalid first data argument; plot error

This is my code :
v01 = get(handles.vel1,'string')
v02 = get(handles.vel2,'string')
v03 = get(handles.vel3,'string')
v04 = get(handles.vel4,'string')
ct01 = get(handles.ct1,'string')
ct02 = get(handles.ct2,'string')
ct03 = get(handles.ct3,'string')
ct04 = get(handles.ct4,'string')
X = [v01, v02, v03, v04];
Y = [ct01,ct02, ct03, ct04];
plot(X,Y)
I am calling input data from edit boxes v01, v02,v03 and v04 to be plotted against calculated values ct01,cto2,cto3 and cto4 resp.
I am not able to plot the data, moreover, it generates error: Error using plot Invalid first data argument

Best Answer

All of the variables v01, etc are strings (which is clear because that is what you are requesting from the edit boxes). But only numeric values can be plotted, not strings. So you need to convert the strings to numeric. I would recommend using str2double:
X = str2double({v01,v02,v03,v04});