MATLAB: Creating a file upload option/button in App designer

app designerMATLAB

Hi all
I am currently using MATLAB App designer to create a waveform generator user interface, and the idea is apart from some standard fucntion been selected and hence generated, i.e. sine/cosine, the interface should also allow user to upload their interested signals such as modulated signal. Therefore I would like to create such a function using App desinger so that when the user click on the button, a file viewing window could pop up for file uploading.
Would someone could give me some hints how I am able to achieve this? Many thanks.
Kind regards,
Chen

Best Answer

  1. Create the button in your GUI (drag and drop the button onto the designer workspace)
  2. Right click the button, hover over 'callbacks', select 'AddButtonPushedFcn callback'.
  3. From the code view that will open after adding the callback function, use matlab's uigetfile function.
% Button pushed function: Button
function ButtonPushed(app, event)
[file,path] = uigetfile('*.mat') %open a mat file
end
See uigetfile documentation for more options.