How to name Array with each of my Arrays in a bulk folder?
1 次查看(过去 30 天)
显示 更早的评论
This is a simple problem yet I can't seem to solve it. I have a set of arrays in a file called 'results'. There are 8 in total, so far I want to separate all of them, to get Array1 = results{1,1}, Array2 = results{2,1}, etc. However, i can't seem to create a for loop that does this. I've tried i=1:length(results), which should give me i=1:8, but hw do i incorporate that into my Array name? Array(i) gives me the porperties of the array instead, which I do not want. Is there a simple way to get Arrayn = results{n,1}?
0 个评论
回答(2 个)
Jan
2021-9-28
编辑:Jan
2021-9-28
Do not hide an index in the name of variables. Although it is piossible to do this using the eval command, it increases the complexity of the code without any benefit, and impedes the processing such that the code can need up to 100 times more tome to be executed.
result{n} is ways better than Array1, Array2, ...
0 个评论
Ravi Narasimhan
2021-9-28
I believe what you are requesting (dynamically naming variables) can be done but is strongly discouraged. Here is a reference for why and how to achieve equivalent results in different ways. There are multiple links within that main one that are worth the time.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!