How can i retrieve variables created in a function?

Hi! I am creating a script where i need to use two functions which i insert in the script. Lets put as an example my function panelgen()--> function [x,z]=panelgen(airf,N,AoA)
Which outputs should be x and z. However when i run it, the output is ans= blabla, and in the workspace there is no evidence of those variables that have been created.
Also, the ans displayed is equal to the first of the variable in the square bracket[x,z] but only to the first one, if i put z in front it will display z.
How can i retrieve those variables to use them in my script?
Thank you very much

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 3 月 28 日

1 投票

Call your function:
[x,z]=panelgen(airf,N,AoA)

4 件のコメント

Jacob
Jacob 2014 年 3 月 28 日
編集済み: Jacob 2014 年 3 月 28 日
ans its equal to x in this case
>> panelgen('2405',250,5*pi/180)
ans =
1.0e+03 *
0.0010
0.0010
0.0010
0.0010
0.0010
0.0010
0.0010
0.0010
0.0010
.
.
.
up to 252 values
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 3 月 28 日
What is your problem?
Jacob
Jacob 2014 年 3 月 28 日
Already solved. I wanted to know how to get my variables created in my function to the global workspace. Thanks
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 3 月 28 日
You can add inside your function
global a b c % a,b and c are your variables
% Do the same thing in Matlab Windows Command

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

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by