How to upload mat files in Matlab App Designer?

2 views (last 30 days)
Hi,
I have to upload some mat files in Matlab App designer. The code in matlab for uploading is:
location = 'Name of the location';
testData = imageDatastore(location, 'FileExtensions', '.mat', 'IncludeSubfolders',true, ...
'LabelSource','foldernames')
testData.ReadFcn = @readFcn1
How do I write this in Matlab App Designer?
Thank you
  2 Comments
Adam
Adam on 7 Oct 2019
You can write code exactly the same in app designer as you can anywhere else. What you want to do with it obviously determines exactly how you hook it up, but to load a mat file in app designer is no different to doing it in a regular function.
Tajana Lusetic
Tajana Lusetic on 7 Oct 2019
I want to be able to choose multiple files from a directory (for my pretrained Neural Network), and I wrote this code
DataLocation=uigetdir(Location of the Data); testData=imageDatastore(fullfile(DataLocation),'FileExtensions','.mat','IncludeSubfolders',true,... 'LabelSource','foldernames');
app.data=testData;
app.data.ReadFcn=@readFcn1;
And when I open the folder, it is empty(it's not showing me my files) and I get an error
Error using imageDatastore.
Files must be a non-empty character vector or string scalar.
So I am stuck.

Sign in to comment.

Answers (0)

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!