How to view a mat file that says preview too large to display Properly in Import Wizard
19 次查看(过去 30 天)
显示 更早的评论
Hi, I want to view a mat file that is 3X3X1,500,000. I doubleclick on the file folder and it shows up in import wizard. There I doubleclick on the file and is too big to view. Same if I click open variablecommand on matlab.
Ideally I would export it to excel. I tried this below while my setpath is set to the right source directory but all I get is an excel file with the name of my mat file across the top cells (one letter per cell). what is my naive error?
xlswrite('QQ.xls', 'QQ_full.mat')
0 个评论
采纳的回答
Rik
2021-11-4
编辑:Rik
2021-11-8
A mat file is a file, not a variable. It may contain variables. Judging from your description it only contains a single variable.
You could export it to an excel file by loading the variable, reshaping to a 2D array (instead of the current 3D), and writing that variable to an excel file.
S=load('QQ_full.mat');
name=fieldnames(S);
data=S.(name{1});
data=reshape(data,size(data,1)*size(data,2),size(data,3));
xlswrite('QQ.xls',data)
This will probably not work due to the limitations of the xls format. You're better off trying to find a way to plot your data to visualize it, instead of looking at a small numeric portion. If you want to do so anyway:
small=data(:,:,10);
7 个评论
Walter Roberson
2021-11-8
S = load('QQ_full.mat');
name = fieldnames(S);
data = S.(name{1});
data = reshape(data, [], size(data,3));
writematrix(data, 'QQ.xlsx')
However, this will fail: it would create a matrix with 9 rows and 1500000 columns, but Excel can never have more than 16384 columns.
You might do
writematrix(data.', 'QQ.xlsx')
which would try to write as 1500000 rows and 9 columns, but Excel can enver have more than 2^20 = 1048576 rows.
You would have to split into multiple sheets, which is what I suggested when you asked much the same question before; https://www.mathworks.com/matlabcentral/answers/47118-how-to-convert-mat-to-xls#comment_1818359
For example, you could split into 9 sheets to account for the 3 x 3 part. Then each sheet would be responsible for 1500000 items, which you could do be reshaping into multiple columns -- as long as you use 2 or more columns, it would fit. Most natural might be to use 1500 rows and 1000 columns -- though sorting might be more difficult in that case. What dimension do you need to sort across?
更多回答(1 个)
Anthony Santana
2021-11-8
11 个评论
Steven Lord
2021-11-9
X = rand(100, 3); % Sample data
P75 = prctile(X, 0.75) % If you're being particularly careful, specify DIM as well
P75_col2 = prctile(X(:, 2), 0.75)
shouldBeSmallOrZero = P75(2) - P75_col2
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!