save data from function to ws
Mostrar comentarios más antiguos
Hello,
I want to save the data of a 8x1 matrix to the workspace from a function. However, the variables in the matrix change every time the function is called, while the name of the Matrix stays the same.
I tried assignin. This works well but now I want to create a matrix consisting of a row of 8x1 variables. I actually want the following;
assignin('base','Pars2(end+1,:)',Pars)
But this doesnt work.
Can anybody help me? Thanks in advance!
Greetings Boudewijn
Respuesta aceptada
Más respuestas (1)
Dishant Arora
el 20 de Feb. de 2014
As the documentation suggests, 2nd parameter has to be only the variable name, it cannot have any indices. Better assign that value to a new variable in workspace and later on add it to existing matrix.
assign('base' , 'newVar', val);
existingMat(end+1,:)=newVar;
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!