How do I change workspace variable?

I am doing a bubble sort in MATLAB and when I run my code, the array is popping up in the workspace and it is named ans
I need that to be named something else. How would one change that ans to a different variable?

 採用された回答

Stephen23
Stephen23 2014 年 9 月 11 日

0 投票

Review MATLAB's own information on calling functions and allocating the outputs.

その他の回答 (2 件)

Hikaru
Hikaru 2014 年 9 月 11 日
編集済み: Hikaru 2014 年 9 月 11 日

0 投票

var_name = ans;
Or in your code, you could've assign a name to it. That way you don't have to manually do it each time.
Image Analyst
Image Analyst 2014 年 9 月 11 日

0 投票

That's what MATLAB calls a result of an expression when you aren't accepting the result into your own variable. For example
4*pi % Not being set equal to anything, it's just by itself.
To get rid of it, simply accept the answer into a variable of your own naming:
myVar = 4 * pi

カテゴリ

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

タグ

質問済み:

2014 年 9 月 11 日

回答済み:

2014 年 9 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by