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!