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');
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