save about 40 string to array and the save this array to file

4 ビュー (過去 30 日間)
Abdulkareem
Abdulkareem 2012 年 12 月 18 日
hi how can i save about 40 string to array ( for example The names of 40 people) into variable(array) and then save these names into file and then Retrieve them back to array

採用された回答

Walter Roberson
Walter Roberson 2012 年 12 月 18 日
編集済み: Walter Roberson 2012 年 12 月 18 日
YourArray{1} = 'first string';
YourArray{2} = 'benchwarmer';
YourArray{3} = 'hot chocolate';
save('YourMATfile.mat', 'YourArray');
clear YourArray %to prove we got them back
TheData = load('YourMATfile.mat', 'YourArray');
YourArray = TheData.YourArray;
clear TheData
YourArray{3}

その他の回答 (1 件)

Jan
Jan 2012 年 12 月 19 日
The commands needed to solve such basic tasks are explained exhaustively in the Getting Started chapters. It is required to read them, when you want to use such a powerful system like Matlab.
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 12 月 19 日
I would say that proper use of load() is not obvious.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by