Matlab GUIDE is a package for generating graphical user interface (GUI) scripts.
Extracting Numerical Data from a Matlab uitable
The table format was set to text using the Table Property Editor.
The number of rows is equal to N.
There are three columns of data: peak, freq, phase.
The data is retrieved using the following commands.
A=char(get(handles.uitable_data,’Data’));
B=str2num(A);
peak=B(1:N);
freq=B((N+1):(2*N));
phase=B((2*N+1):(3*N));
Save & Retrieve Data between Functions
Store data
setappdata(0,’SPL’,SPL);
Retrieve data
data=getappdata(0,’SPL’);
Write Data to the Matlab Workspace
Define an edit box called edit_output_array. Then…
output_name=get(handles.edit_output_array,’String’);
assignin(‘base’, output_name, data);
h = msgbox(‘Save Complete’);
Open a New Dialog Box from within an Existing One
handles.s= new_dialog_box_name;
set(handles.s,’Visible’,’on’);
Close Dialog Box
delete(dialog_box_name);
Write 2D Array to External ASCII Text File
The 2D array is called data.
[filename, pathname] = uiputfile(‘*.txt’,’Save PSD As’);
writepfname = fullfile(pathname, filename);
fid = fopen(writepfname,’w’);
n=length(data(:,1));
for k=1:n
fprintf(fid,’%13.6e \t %11.4e \n’,data(k,1), data(k,2));
end
fclose(fid);
h = msgbox(‘Save Complete’);
* * *
– Tom Irvine