필터 지우기
필터 지우기

Help me with this code

조회 수: 2 (최근 30일)
Andrea Verardi
Andrea Verardi 2019년 11월 5일
댓글: darova 2019년 11월 5일
Hi, I have a problem.
How can I use an output parameter from a function in a live script .mlx?
For example, how can I use the 'n' parameter in the Live Script from the following function?
function [n] = stat(x)
n = (x+1/x)
end
If I try to use it, the "Undefined Function or Variable 'n'." Error Message shows up.
I have a simple Live Script like this:
x = 3; % or other numbers of choice
stat(x);
n
I just need to be able to manipulate 'n' in the Live Script after the use of the function 'stat(x)'.
Thanks in advance for the assistance.

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 11월 5일
y=stat(x); % here n value reflects on y,
Or
You can keep the same output argument name, like
n=stat(x);
  댓글 수: 2
Andrea Verardi
Andrea Verardi 2019년 11월 5일
thank you so match
darova
darova 2019년 11월 5일
please accept the answer

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by