How to construct a script to create a vector of variables from many different scripts
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
At the moment I have a script for each set of data I am working with (a bad way of doing things I am sure), which performs the same calculations on each data set.
I want to write a script which stores the same variable from each script into a vector. However, when I run the following script, it obtains each variable value fine, but when storing it in the vector, the preceding variable value is set to 0, so I end up with a vector of zeros with only the last value non-zero.
Here is what I've attempted to far, trying to construct a vector of data file lengths:
Script1
metaCSstat(1)=filelength;
Script2
metaCSstat(2)=filelength;
Script3
metaCSstat(3)=filelength;
I end up with a vector[0 0 filelength(from Script3)]
Sorry if this explanation is a little convoluted, I hope it is understandable.
Many thanks for any help with this matter
0 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 5 de Ag. de 2012
Editada: Azzi Abdelmalek
el 12 de Sept. de 2012
check your scripts, is there any "clear" insstruction; or is your variable "metaCSstat" used in those scripts? I notice also in your example you are using two differtents variables:
metastat(1)=filelength;
metaCSstat(2)=filelength;
Más respuestas (2)
Oleg Komarov
el 5 de Ag. de 2012
Editada: Oleg Komarov
el 5 de Ag. de 2012
It's hard to say without knowing what you do in the scripts, but two things:
- metastat is not metaCSstat
- If you are using clear(), especially clear all in the scripts that would explain.
Josh
el 5 de Ag. de 2012
2 comentarios
Image Analyst
el 5 de Ag. de 2012
You can clear specific individual variables if you want
clear justThisVariable;
clear('thisVariable', 'andAlsoThisOne');
Ver también
Categorías
Más información sobre Historical Contests en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!