I'm writing this back because I understood that I was not clear. So, I'm having huge issues with my task to use a button on the interface to execute a function and to give back some results. Let's paste the code:
fig = uifigure('Name', 'Intro');
fig.Position = [500 460 600 150];
txt = uitextarea(fig, 'Position', [25, 70, 445, 22]);
btn = uibutton(fig, 'Text', 'Sfoglia', 'Position', [475, 70, 100, 22]);
btn.ButtonPushedFcn = @ActionButtonPushed;
What did I mean to do?
- I create the button
- I told the button "if I press you, you must enact this function"
So, what is this function?
function [file, path] = ActionButtonPushed(btn, txt)
[file, path] = uigetfile('*.xlsx','Selezione del file');
end
This function (where actually I want to use as an input just the fact I pressed the button) has to make me browse a file, and get the file name ("file") and the path to the file ("path"), as I usually get with uigetfile, so that then I can use these two to go on.
What does the code actually do? I press the button, the window where I choose the file opens, I select the file, and then no results are given. So I can't proceed
4 Comments
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/663538-get-file-name-and-path-of-the-file-when-i-browse-with-a-button#comment_1162378
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/663538-get-file-name-and-path-of-the-file-when-i-browse-with-a-button#comment_1162378
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/663538-get-file-name-and-path-of-the-file-when-i-browse-with-a-button#comment_1162443
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/663538-get-file-name-and-path-of-the-file-when-i-browse-with-a-button#comment_1162443
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/663538-get-file-name-and-path-of-the-file-when-i-browse-with-a-button#comment_1162578
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/663538-get-file-name-and-path-of-the-file-when-i-browse-with-a-button#comment_1162578
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/663538-get-file-name-and-path-of-the-file-when-i-browse-with-a-button#comment_1162588
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/663538-get-file-name-and-path-of-the-file-when-i-browse-with-a-button#comment_1162588
Sign in to comment.