How to store intermediate result

I am doing RBF Implementation. I have 5 values in centerset. While the substraction operation gs=normdatval(1,1:4)-centerset(1,1:4) I want to store my result each time(5times) in different variables like g1,g2,g3,g4,g5.Please help

1 comentario

Star Strider
Star Strider el 20 de Mayo de 2014
Please don’t!
Just keep them as an array. You can access them just as easily from a vector (or matrix) array as from different variables, and it’s much less confusing with an array.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 20 de Mayo de 2014
Try this:
g1=normdatval(1,1:4)-centerset(1,1:4)
g2=normdatval(1,1:4)-centerset(1,1:4)
g3=normdatval(1,1:4)-centerset(1,1:4)
g4=normdatval(1,1:4)-centerset(1,1:4)
g5=normdatval(1,1:4)-centerset(1,1:4)
Though for any more than about that many, you're better off creating an array. And you certainly don't want to create hundreds of separately named variables in a loop. Why not? See the FAQ : http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Preguntada:

el 20 de Mayo de 2014

Respondida:

el 20 de Mayo de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by