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 commentaire

Star Strider
Star Strider le 20 Mai 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.

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 20 Mai 2014

0 votes

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

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by