Info

This question is closed. Reopen it to edit or answer.

GUI's use

3 views (last 30 days)
Abbass SAYEGH
Abbass SAYEGH on 2 Jul 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello everyone,
I am there because i work on a project with graphic interface. I need help.
In fact, I need in my interface two buttons, one which allows just to select a file (xlsx, png) without opening it, and a second which allows to open the desired file.
so far i have only one button that selects and opens the file, but i need two in my GUIDE interface
Thank you!

Answers (1)

Image Analyst
Image Analyst on 2 Jul 2020
Try this
For the first function callback, you can call uigetfile:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = pwd; % or 'C:\wherever';
if ~isfolder(startingFolder)
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
For the second function, you can call
winopen(fullFileName);
Attach your .-file and fig-file if you still need more help.

This question is closed.

Tags

Community Treasure Hunt

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

Start Hunting!