make many matrices with for loop
1 件のコメント
"I want to make 272 matrices by automatically"
While that is possible, in practice dynamically naming variables is how some beginners force themselves into writing slow, complex, buggy, and hard to debug code. The MATLAB documentation specifically advises against naming variables dynamically: "A frequent use of the eval function is to create sets of variables such as A1, A2, ..., An, but this approach does not use the array processing power of MATLAB and is not recommended. The preferred method is to store related data in a single array." Read this to know more:
As the MATLAB advises, you should store the imported data in one array: that array might be a table, cell array, a matrix, or an ND array (which to choose depends on the data and what you want to do with it). Using one array makes looping over the files/data easy, makes accessing and processing the data very simple, and is much easier to debug (thus wasting less of your life debugging). Within the loop you will probably need to use indexing: indexing is simple, neat, and very efficient.
How to process a sequence of files is also explained in the MATLAB documentation:
https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html
You should also read about the different file importing functions that can import text files:
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!