How does MATLAB run load, importdata, matfile functions
古いコメントを表示
Hi,
I am wondering if anyone knows the actual process MATLAB run function load and matfile. I have a .mat file with a single variable that consists of a column of cells.
I try loading with both function
load(full_path)
and
temp_file = matfile(full_path);
data = temp_file.data;
I am using MATLAB R2015a and on my machine, the second method with matfile usually out performs the first one (load faster). It seems weird to me. I try opening both function and look at their code, but unfortunately they are built-in functions. I am wondering if anyone knows what is the reason behind this. Thanks
採用された回答
その他の回答 (1 件)
Steven Lord
2017 年 1 月 25 日
0 投票
How many variables are in your MAT-file? How large and/or complicated are the variables NOT named data? Your first code that calls load cares about the answers to those two questions, because it needs to load ALL those variables into the workspace. I'm not certain how much (or if) the second code cares what else is in the MAT-file.
If you wanted a more apples-to-apples comparison, call load and indicate you want to read just the variable named data into memory using the variables input argument.
カテゴリ
ヘルプ センター および File Exchange で Workspace Variables and MAT Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!