Including comments in a .mat file?
7 次查看(过去 30 天)
显示 更早的评论
Is there any way to include comments (or similar) in a '.mat' file to indicate what the stored variables are?
0 个评论
回答(3 个)
Jos (10584)
2014-2-7
编辑:Jos (10584)
2014-2-7
Another option might be to use a structure:
A.values = [21 22 35]
A.label = 'temperature'
A.unit = 'degrees Celsius'
A.comment = 'measured with Pete''s device'
0 个评论
Azzi Abdelmalek
2014-2-7
编辑:Azzi Abdelmalek
2014-2-7
You can get those information. Look at this example
a=1;
b=2;
c=3;
save filename a b c
clear;
load filename
whos -file filename.mat
%or
data=load('filename')
var_names=fields(data)
4 个评论
Azzi Abdelmalek
2014-2-7
You can also create a function for each file you want to load
function filename
% comment1
% comment2
% .....
load filename
To load the file filename just type
filename
To see the comments type
help filename
另请参阅
类别
在 Help Center 和 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!