Loading a Variable with its Original Format
2 次查看(过去 30 天)
显示 更早的评论
B is double. When I load B, this function put it in a struct format. How can I load B with double format?
C = load( ‘A.mat’, ‘B’);
0 个评论
采纳的回答
Stephen23
2017-1-11
编辑:Stephen23
2017-1-11
C = load( ‘A.mat’, ‘B’);
B = C.B;
Note that you do not actually need to assign the variable B. Instead you can simply access the structure field whenever you need to:
mean(C.B)
Although some people might tell you to do this:
load( ‘A.mat’, ‘B’);
in fact this is a very bad way to load data. It means that variables magically "poof" into existence in the workspace. Much better is to load into a structure.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!