Borrar filtros
Borrar filtros

how to get element of a matrix that defined as a function?

3 visualizaciones (últimos 30 días)
reza hamzeh
reza hamzeh el 16 de Dic. de 2019
Editada: Stephen23 el 16 de Dic. de 2019
hi. suppose this matrix function. how can i get its elements ? for example ha(1,1) dosent work.
ha=@(J) [0 J;1 J];

Respuesta aceptada

Stephen23
Stephen23 el 16 de Dic. de 2019
That numeric matrix is only created when the function is called, it does not exist beforehand.
So you need to call the function, assign its output to a variable, and then use indexing:
M = ha(5)
M(1,1)

Más respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by