how to create contour with looping for each every data

2 visualizaciones (últimos 30 días)
gugum gumbira
gugum gumbira el 14 de Abr. de 2016
Editada: Stephen23 el 27 de Jun. de 2019
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 comentario
Stephen23
Stephen23 el 14 de Abr. de 2016
Editada: Stephen23 el 27 de Jun. de 2019
" 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by