How can I use Function handle with arrays?

1 回表示 (過去 30 日間)
Raja Vardhan Reddy Kothakapu
Raja Vardhan Reddy Kothakapu 2019 年 5 月 14 日
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 日
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)
  1 件のコメント
Raja Vardhan Reddy Kothakapu
Raja Vardhan Reddy Kothakapu 2019 年 5 月 14 日
@Adam Thanks for your reply.

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by