how to use arrayfun

2 views (last 30 days)
Luca Re
Luca Re on 18 Dec 2023
Answered: Voss on 19 Dec 2023
Eq.Data is a struct with 2 fields
data is 5864x1 datetime
R1 is 1x27 double
i want to create the follow array:
TradeF(1)=Eq.Data(738) (because r1(1) = 738 )
TradeF(2)=Eq.Data(734) (because r1(2) = 734 )
...
i try to use arrayfun but i but not so use it correctly
T.TradeF=arrayfun(@(s,i)s.data(i),Eq,r1)';
i receive this error:
Error using arrayfun
All of the input arguments must be of the same size and shape.
Previous inputs had size 1 in dimension 2. Input #3 has size 27
  1 Comment
Sulaymon Eshkabilov
Sulaymon Eshkabilov on 19 Dec 2023
Your question is NOT clear. Please reformulate it.

Sign in to comment.

Accepted Answer

Voss
Voss on 19 Dec 2023
TradeF = Eq.data(r1);

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!