how to create contour with looping for each every data

조회 수: 1 (최근 30일)
gugum gumbira
gugum gumbira 2016년 4월 14일
편집: Stephen23 2019년 6월 27일
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