Cell to matrix under new variable
3 次查看(过去 30 天)
显示 更早的评论
Hi, I was wanting to convert individual cells to a matrix. For example;
A = 1x? cell % Each cell icontains just numerical values of size 3x3
B1 = [A{1,1}];
B2 = [A{1,2}];
etc .....
B? = [A(1,?)];
I essentially need the A cell's to each be converted to a matrix, however, that is for A = 1 by any number of cells. E.g. A = 1 x 6 cell or A= 1 x 12 cell etc. Just wondering how to store each cell as a matrix under a new variable each time e.g. B1, B2, ... B?. Thanks!
0 个评论
回答(1 个)
James Tursa
2021-2-8
Do not do this! You are taking a method of storing your data that is easy to maintain and access (e.g., in a loop) and proposing using named variables that will be hard to maintain and access downstream in your code. See this link:
Keep your variables in the cell array, or if they are all the same size consider concatenating them into a single 3D array. Your downstream coding will be much easier!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!