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

 採用された回答

Stephen23
Stephen23 2017 年 4 月 14 日

2 投票

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});

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で MATLAB についてさらに検索

質問済み:

2017 年 4 月 14 日

コメント済み:

2017 年 4 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by