フィルターのクリア

How to convert .mat to .xls

512 ビュー (過去 30 日間)
Farhan
Farhan 2012 年 8 月 31 日
コメント済み: Walter Roberson 2023 年 4 月 6 日
Please help me out in a detail manner xlswrite command is not working
  8 件のコメント
Walter Roberson
Walter Roberson 2018 年 3 月 28 日
Your .mat file train_subject01.mat did not contain a variable named train_subject01 . You should use
whos -file train_subject01.mat
to see the names of the variables in the file.
Zhibo
Zhibo 2022 年 8 月 2 日
我做了一个matToExcel工具可以在线处理这个问题

サインインしてコメントする。

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 31 日
data=load('FileName');
f=fieldnames(data);
for k=1:size(f,1)
xlswrite('FileName.xlsx',data.(f{k}),f{k})
end
  15 件のコメント
Anthony Santana
Anthony Santana 2021 年 11 月 5 日
Hi,
I am trying to convert an output mat file which contains 1.5MM rows of numbers to an excel file.Smeone suggested I change it from 3D to 2D first. I tried the following codes and nothing works. Can you fix it?
S=load('QQ_full.mat');
data=S.QQ;
data=reshape(data,size(data,1)*size(data,2),size(data,3));
writetable(S.QQ,data,'Sheet',1,'Range','A1')
Error using writetable (line 248)
Unsupported type 'double'. Use writematrix instead.
Did you mean:
>> writematrix(S.QQ,data,'Sheet',1,'Range','A1')
Error using matlab.io.xml.internal.write.errorIfXML (line 6)
FILENAME must be a non-empty character vector or string scalar.
Error in writematrix (line 196)
fileType = matlab.io.xml.internal.write.errorIfXML(filename, supportedFileTypes, varargin{:});
Walter Roberson
Walter Roberson 2021 年 11 月 5 日
編集済み: Walter Roberson 2021 年 11 月 5 日
S=load('QQ_full.mat');
data=S.QQ;
Okay, at that point S.QQ and data are the same.
data=reshape(data,size(data,1)*size(data,2),size(data,3));
and data gets reshaped so S.QQ and data now have the same content but different shape.
writematrix(S.QQ,data,'Sheet',1,'Range','A1')
You are asking to write out S.QQ, which is the original shape, and you are asking that it be written to a file whos name is stored in data .
You should be using something like
writematrix(data, 'Q_reshaped.xlsx', 'Sheet', 1, 'Range', 'A1')
However...
I am trying to convert an output mat file which contains 1.5MM rows of numbers to an excel file.
You have a problem. The largest file that excel supports is 1048576 rows, and you are creating more rows when you reshape.
The maximum number of columns for excel is 16384, so you would need to use permute() and reshape() to re-arrange your data to have fewer rows but more columns, but still fit within the 2^20 x 2^14 = 2^34 element = 16 giga-element (powers-of-two meaning of "giga" here). If numel(s.QQ) > 2^34 then you have no hope of fitting it into a single excel sheet.
You might want to write sections to different sheets.
What is size(S.QQ) ?

サインインしてコメントする。

その他の回答 (1 件)

kinju Prajapati
kinju Prajapati 2019 年 1 月 11 日
how to load my own datset for training and testing....
nprtool only respond inbuilt or example dataset..not my dataset,,,,
  4 件のコメント
Abhishek
Abhishek 2023 年 4 月 6 日
編集済み: Abhishek 2023 年 4 月 6 日
Hi @arun anoop m, can you show me how to transfer all data dictionary data to excel ?
Walter Roberson
Walter Roberson 2023 年 4 月 6 日
I am not clear whether you are referring to a Simulink Data Dictionary https://www.mathworks.com/help/simulink/slref/simulink.data.dictionary.html or if you are referring to the releative new dictionary mapping object?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by