フィルターのクリア

Pass variables's name and their values from function to function

1 回表示 (過去 30 日間)
Mohammad
Mohammad 2012 年 3 月 31 日
Hello Dear: How can i pass the variables and their values from a function to another function within a GUI programming? Thank you.
for a simple example:
functin .... a1=10;
function .... a2=a1*10;

採用された回答

Jan
Jan 2012 年 3 月 31 日
You pass the value of the variable only. The name of variables does not matter usually. Keeping important information in the name of a variable is a bad programming practice. See: FAQ: How to create A1, A2, ....
If you really want to pass a value and a name to a function, use something like:
function myFunc(Name, Value)
with Name is a string carrying the name and Value is the value. If this sounds trivial - sorry. Sometimes the trivial solutions are the best.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 3 月 31 日

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by