Creating a Matrix from Variables Window
1 回表示 (過去 30 日間)
古いコメントを表示
I create the variable G = []; in the Editor and then click on its name on Workspace and start typing in a 5 by 10 matrix there. Whenever I run the script, G becomes a 0-by-0 matrix from a 5-by-10 matrix. How can I tell MATLAB to change G to a 5-by-10 matrix and doesn’t change it to a 0-by-0 matrix?
0 件のコメント
回答 (2 件)
Jan
2017 年 1 月 12 日
The command "G = []" sets G to the empty matrix. If you do not want to do this, omit this command. Instead of using the Variable editor, you can write the contents directly to the code:
G = [1,2,3,4,5; 6,5,4,3,2]
0 件のコメント
Rightia Rollmann
2017 年 1 月 12 日
1 件のコメント
Steven Lord
2017 年 1 月 12 日
Then you need to find another way to import that data into MATLAB. Since you mention Microsoft Excel, see if xlsread can handle your file.
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!