Loading a Variable with its Original Format

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’);

 採用された回答

Stephen23
Stephen23 2017 年 1 月 11 日
編集済み: Stephen23 2017 年 1 月 11 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeStructures についてさらに検索

質問済み:

2017 年 1 月 11 日

編集済み:

2017 年 1 月 11 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by