How do you use App designer to read files from a folder, list the name of the variable stored, select them and save in CSV

13 views (last 30 days)
I need an app that is able to look inside a .mat file, list the variable stored in there, select the ones that needs to be and save them in a directory tht needs to be selected too. It is a workplace were not everybody are able to use matlab. I was thinking at an easy way to do that.

Answers (1)

Shreeya
Shreeya on 27 Feb 2024
Hello
To load mat files and perform operations on them using the app designer, you can use, for example, the button component and define a callback function for a click event. Load the mat file as an app property as follows:
% Button pushed function: Button
function ButtonPushed(app, event)
app.file = load('file.mat');
end
Further, you can implement the other required functionalities in the callback functions of same/other components which can access the file contents using the app.file property. Refer to the following link to learn more:
  1 Comment
Fabio
Fabio on 27 Feb 2024
It does not work, below the error. But more than this, the button is to load a file I know the name. What I am looking for is something really different. After clicking the button (or whatever is good for the following) a sort of menu needs to be opened, showing directories and files so I can change directory and choose the file I need to.
Unrecognized property 'file' for class 'app1'
% Button pushed function: LoadmatfileButton
function LoadmatfileButtonPushed(app, event)
app.file = load('240220_115913.mat');
end

Sign in to comment.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!