필터 지우기
필터 지우기

Creating a file upload option/button in App designer

조회 수: 192 (최근 30일)
Shuyuan Chen
Shuyuan Chen 2019년 3월 11일
댓글: Adam Danz 2022년 9월 26일
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

채택된 답변

Adam Danz
Adam Danz 2019년 3월 11일
편집: Adam Danz 2019년 3월 12일
  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.
  댓글 수: 4
Emily
Emily 2022년 9월 26일
Could this be modified to open an .xls file or is this specific to .mat files?
Adam Danz
Adam Danz 2022년 9월 26일
No, you could change the file extension '*.mat' to specify the type of file you'd like to open or any other type of filter. It's quite flexible.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sergio Prado Raposo
Sergio Prado Raposo 2021년 11월 24일
How can I make it so that when I try to open a file with another extension, it shows an error box and if it is the correct one, it shows a correct text box?

카테고리

Help CenterFile Exchange에서 Standard File Formats에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by