I'm trying to use function handle with arrays. My objective is to create a function which picks a particular element of one dimensional row matrix. It need to output the particular element when I pass matrix and index as arguments. I know there are other ways to do this, but I'm very much interested to see whether this task can be done by function handle or not
Thanks
syms I t
G = matlabFunction(I(t))
A = [1 2 3];
G(A,1)

 채택된 답변

Adam
Adam 2019년 5월 14일
편집: Adam 2019년 5월 14일

0 개 추천

Not really sure how the code you posted, with syms and matlabFunction is connected to what you are asking, but this function should do what you ask:
f = @(x,idx) x(idx)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by