how to extract (lopp) double variables from cell array?

9 ビュー (過去 30 日間)
alfonso gravante
alfonso gravante 2020 年 10 月 8 日
コメント済み: alfonso gravante 2020 年 10 月 18 日
Hello guys, I am novice with matlab and I can not solve this problem. I have two cell arrays one of 16x1 containing double variables [33x1000] and another 16x1 containing labels. My purpose is to extract the double variables from the cell array and rename these variables with the labels contained in the other cell array, with a lopp.
Do you have any idea how I can proceed?
Thanks you!!
  1 件のコメント
Stephen23
Stephen23 2020 年 10 月 13 日
編集済み: Stephen23 2020 年 10 月 13 日
"My purpose is to extract the double variables from the cell array and rename these variables with the labels contained in the other cell array..."
What exactly is the goal of this? Why do you need to do this?
Don't tell us about the code you are trying to write, explain what you are trying to achieve and how you want to process your data.

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

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 8 日
編集済み: Ameer Hamza 2020 年 10 月 8 日
Not a good idea to name variables dynamically: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval. Your current data structure is fine. You might benefit by creating a table to further organize your data
C1; % cell array of matrices
C2; % cell array of labels
T = table(C1, C2)
  5 件のコメント
Stephen23
Stephen23 2020 年 10 月 16 日
"It's possible automate the last step?"
Yes. As long as you can access some data using indexing or fieldnames (or similar) then you can easily process them in a loop. Exporting data to multiple files is a very common task, and the MATLAB documentation shows the basic approach:
Use the sprintf to generate the filename, and then save your data using an appropriate function.
alfonso gravante
alfonso gravante 2020 年 10 月 18 日
thanks a lot for the suggestions!!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by