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 件のコメント

Star Strider
Star Strider 2014 年 5 月 20 日
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.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2014 年 5 月 20 日

0 投票

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

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2014 年 5 月 20 日

回答済み:

2014 年 5 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by