I’ve been at this for 3 hours — so I need help.
I have a button on MATLAB’s 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 is under the pushbutton load_file as follows:
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)
loadwill load a text file, but it won’t assign the contents to anything unless you explicitly specify an output.The
-asciioption of load is not necessary, but guarantees that the file is loaded as text, and will help you remember later that the data is supposed to be a text file.