Edit box string to column value plotting

Im attempting to use edit boxes in a GUI as away to destinguish what columns a plot command recognizes as a plot
numdata=xlsread(uigetfile({'.xlsx'},'File Selector'));
x=numdata(:,str2num(handles.XCInput, 'string'));
y=numdata(:,str2num(handles.YCInput, 'string'));
plot (x,y)
XCInput and YCInput are the tags for the chosen text edits

4 件のコメント

Adam Danz
Adam Danz 2019 年 6 月 19 日
What problems are you having?
Could you provide an example of a string stored in handles. XCInput and YCInput?
Greg Morris
Greg Morris 2019 年 6 月 19 日
The program just simply won't run.
Stephen23
Stephen23 2019 年 6 月 19 日
編集済み: Stephen23 2019 年 6 月 19 日
What is this syntax supposed to do?:
str2num(handles.YCInput, 'string')
I don't see anything in the str2num documentation about two input arguments.
Greg Morris
Greg Morris 2019 年 6 月 19 日
It is to take the given value of edit text boxes
Where as the first code was
numdata=xlsread(uigetfile({'.xlsx'},'File Selector'));
x=numdata(:,1);
y=numdata(:,2);
plot (x,y)
The code in question is so that you can imput any given number into a gui edit box and then that number the the column read to be plotted

サインインしてコメントする。

 採用された回答

Stephen23
Stephen23 2019 年 6 月 19 日
編集済み: Stephen23 2019 年 6 月 19 日

0 投票

You invented a str2num syntax that does not exist:
str2num(handles.YCInput, 'string')
% ^^^^^^^^^^ is this in the STR2NUM documentation?
Where in the STR2NUM documentation is the 2nd input shown? (hint: nowhere, it does not exist).
If you want to use functions, you need to follow the syntaxes that they actually support:
x = numdata(:,str2num(handles.XCInput));

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

製品

タグ

質問済み:

2019 年 6 月 19 日

編集済み:

2019 年 6 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by