Assign array as variables with function's output

1 回表示 (過去 30 日間)
wang wang
wang wang 2018 年 3 月 30 日
For example
function s = fun(i)
a=i;
b=i*i;
c=i*i+5;
d=i+6;
e=i*i*i;
global count;
s(count)=[a,b,c,d,e];
count count+1;
end
fun() will output an array that contains 5 element,and I would like to assign these array as variables with function's output.But obviously,it will show" Subscripted assignment dimension mismatch"at all since I assign array into another array,but I have no idea how to make s to be an effective variables.
sorry for my poor English and knowledgement.

回答 (0 件)

カテゴリ

Help Center および File Exchange运算符和基本运算 についてさらに検索

Community Treasure Hunt

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

Start Hunting!