Partially loading matirx with matfile doesn't work
Afficher commentaires plus anciens
I was trying to use matfile to partially load a big matrix storing in a v7.3 .MAT file. I had specified the colum Index but I don't think partially loading work for my case. I test the speed and matfile is just equally slow as load. However, when i tried to load along the row direction, matfile does work much and much faster than load.
Here is my question. Does partially loading function of matfile only work for row direction loading? I think it could be reasonable considering the row oriented memory storage strategy of MATLAB. But i really need confirm this. FYI, I also attached my test codes.
% ----- loading along columns
% matfile shows just equally speed as load
uxtMatrix = zeros(5000,50);
tic
for i = 1:50
Mat = matfile(matFilesv7_3{i});
uxtMatrix(i,:) = Mat.matrix(:,100);
end
toc
%
tic
uxtMatrix2 = zeros(5000,50);
for i = 1:50
load(matFilesv7_3{i},'matrix');
uxtMatrix2(i,:) = uxt(:,100);
end
toc
% ----- loading along rows
% matfile is much much faster! it works here
uxtMatrix = zeros(50,10000);
tic
for i = 1:50
Mat = matfile(matFilesv7_3{i});
uxtMatrix(i,:) = Mat.matrix(20,:);
end
toc
%
tic
uxtMatrix2 = zeros(50,10000);
for i = 1:50
load(matFilesv7_3{i},'matrix');
uxtMatrix2(i,:) = uxt(20,:);
end
toc
Réponses (1)
Feng Cheng
le 15 Déc 2021
Modifié(e) : Feng Cheng
le 15 Déc 2021
1 commentaire
Feng Cheng
le 15 Déc 2021
Modifié(e) : Feng Cheng
le 15 Déc 2021
Catégories
En savoir plus sur Workspace Variables and MAT Files dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!