Load File in GUI GUIDE to Read 2 Columns

1 Ansicht (letzte 30 Tage)
Amanda
Amanda am 1 Sep. 2012
I've been at this for 3 hours -- so I need help.
I have a push button on the GUI GUIDE to load a text file to store 2
columns of data as x and y. So x = 12,12,23.
textfile A is:
12 23
12 32
23 32
The code that is in the GUI GUIDE under the pushbutton load_file is:
filename = uigetfile('*.txt')
loaddata = fullfile(pathname,filename)
load(loaddata)
A = filename(:,1)
B = filename(:,2)
handles.input1 = A;
handles.input2 = B'
axes(handles.axes1)
plot(handles.input1,handles,imput2)
Thanks, Amanda

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 1 Sep. 2012
AB = load(loaddata);
A = AB(:,1);
B = AB(:,2);
Also, you will probably want to
guidata(gcf, handles);
after you assign to handles.input2

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by