Problem of tensor extraction

 Accepted Answer

Matt J
Matt J on 26 Dec 2021
Edited: Matt J on 27 Dec 2021
Perhaps this is what you want,
sub=repmat({':'},1,n);
sub(i)={1};
Y=W(sub{:});

2 Comments

Nice code, bro. But the second line should be changed into sub{i} = l ;
Matt J
Matt J on 27 Dec 2021
Edited: Matt J on 27 Dec 2021
You're right, and I've edited the answer accordingly, but please Accept-click the answer if it provided what you needed.

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Release

R2014b

Asked:

on 26 Dec 2021

Edited:

on 27 Dec 2021

Community Treasure Hunt

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

Start Hunting!