have. mat file on my computerhowto upload to matalb
Show older comments
have many .mat files on my computer. how do i uplad the to matlab online
Answers (1)
Deepak Gupta
on 15 Dec 2024
0 votes
Hi Diana,
You can zip your files and load it onto matlab online. This worked for me, hope it helps.
Thanks,
Deepak
7 Comments
diana
on 15 Dec 2024
Deepak Gupta
on 15 Dec 2024
Sorry but it's not clear what are you trying to do with these files. If you are trying to export this data to csv files, than:
- Unzip .mat files using unzip command.
- Parse through each file and load the content using load function and save it in csv files i.e. csvwrite('my_data.csv', data); If you want to save content in single csv file, keep file name same.
- If you have saved data into multiple .csv files than you can zip it and then download.
diana
on 18 Dec 2024
Moved: Walter Roberson
on 18 Dec 2024
Walter Roberson
on 18 Dec 2024
csv_directory = '.'; %directory holding input files. adjust as needed
excel_directory = '.'; %directory to hold output files. adjust as needed
if ~isdir(excel_directory); mkdir(excel_directory); end
dinfo = dir( fullfile(csv_directory, '*.csv'));
filenames = fullfile({dinfo.folder}, {dinfo.name});
numfiles = length(filenames);
for K = 1 : numfiles
thisfile = filenames{K};
[~, basename, ext] = fileparts(thisfile);
outfile = fullfile( excel_directory, [basename '.xlsx']);
thisdata = readtable(thisfile);
writetable(thisdata, outfile);
end
Deepak Gupta
on 18 Dec 2024
@diana Try Walter's script. You can also try dragging and dropping. I am using a windows machine and it works for me.
diana
on 18 Dec 2024
Walter Roberson
on 19 Dec 2024
The excel_directory that is in the workspace is only a variable naming the destination directory for the excel files. The excel_directory in the workspace is not the content of the excel files -- only the path to where the files are to be stored.
You can
zip('ZIPFILENAMEGOESHERE.zip', fullfile(excel_directory, "*.xlsx"))
to create ZIPFILENAMEGOESHERE.zip and then download ZIPFILENAMEGOESHERE.zip onto your Mac (right-click it in the file browser to get a download menu item.)
Categories
Find more on Spreadsheets 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!