How to view a mat file that says preview too large to display Properly in Import Wizard
27 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Anthony Santana
am 4 Nov. 2021
Kommentiert: Steven Lord
am 9 Nov. 2021
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 Kommentare
Akzeptierte Antwort
Rik
am 4 Nov. 2021
Bearbeitet: Rik
am 8 Nov. 2021
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 Kommentare
Walter Roberson
am 8 Nov. 2021
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?
Weitere Antworten (1)
Anthony Santana
am 8 Nov. 2021
11 Kommentare
Steven Lord
am 9 Nov. 2021
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
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!