MATLAB Answers

How to suppress anonymous function handle being created?

조회 수: 23(최근 30일)
Peyton Wilson
Peyton Wilson 2021년 9월 19일 4:43
댓글: Walter Roberson 2021년 9월 19일 23:31
Hello, i have written the following anonymous function in a loop. Is there a way to prevent the following from being displayed after each iteration? I already have a semicolon at the end of the line. Thank you
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 9월 19일 5:24
please show the line of code exactly as it is in your program (copy and paste)

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

답변(2개)

Jan
Jan 2021년 9월 19일 14:37
편집: Jan 2021년 9월 19일 14:38
As usual the created variable is not shown, if you append a semicolon ; after the command.
a = @(x) sin(x) % Output:
a = function_handle with value:
@(x)sin(x)
b = @(y) cos(y); % No output:

Image Analyst
Image Analyst 2021년 9월 19일 15:38
편집: Image Analyst 2021년 9월 19일 15:46
You don't need to define it in a loop. You can define it outside the loop and just add the other variables to the input argument list.
Do you have
Fh_intd
by itself, in the loop, with no semicolon and nothing else on that line? If so, that would cause it to say what it was.
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 9월 19일 23:31
The loop might be changing some of the variables rho, g, R, w, h . The function handle might potentially be used for something like integration and so might represent the parameterization with respect to specific values of the variables.

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

제품


릴리스

R2006a

Community Treasure Hunt

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

Start Hunting!

Translated by