How to suppress anonymous function handle being created?

1 visualización (últimos 30 días)
Peyton Wilson
Peyton Wilson el 19 de Sept. de 2021
Comentada: Walter Roberson el 19 de Sept. de 2021
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 comentario
Walter Roberson
Walter Roberson el 19 de Sept. de 2021
please show the line of code exactly as it is in your program (copy and paste)

Iniciar sesión para comentar.

Respuestas (2)

Jan
Jan el 19 de Sept. de 2021
Editada: Jan el 19 de Sept. de 2021
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 el 19 de Sept. de 2021
Editada: Image Analyst el 19 de Sept. de 2021
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 comentario
Walter Roberson
Walter Roberson el 19 de Sept. de 2021
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos


Versión

R2006a

Community Treasure Hunt

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

Start Hunting!

Translated by