how to create contour with looping for each every data

2 次查看(过去 30 天)
Dear all, I have several data ZA000060, ZA000120, ZA000180, ZA000240, and ZA000300. now I would to create contour for each data with looping. truthfully, I feel difficult to do that. any help would be great. Thanks alot
  1 个评论
Stephen23
Stephen23 2016-4-14
编辑:Stephen23 2019-6-27
" truthfully, I feel difficult to do that."
Yes, it is difficult.
The reason it is difficult is because you chose to store your data in separate variables. If you had put all of your data in just one variable then it is trivial top loop over it using indices (or fieldnames). This has already been explained to you in your earlier question:
and you even accepted an answer that put those data into one cell array. So you took a simple answer using a cell array and by removing the cell array made your own life much more complicated (because now you cannot access those variables very easily).
It really is that simple: using one variable solves your problem.
Bad program design makes difficult, slow, and buggy code. And by storing all of your data in separate variables you just made accessing those data more complicated that if you put them simply into one variable. No matter how many times beginners love to dream up the idea that they can access lots of variables dynamically, it is actually just slow, buggy, and obfuscated code.
Best solution: store your data in one variable, then use indexing or fieldnames to access it. This will be much much faster, neater, and more reliable than any hack solution you can find to access lots of variables.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by