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