short and sweet simple question

I have a cell array called S that looks like: S = [1 x 3 double]; [1 x 3 double]; [1 x 3 double]
and a vector with corresponding rows that looks like: x = [0;1;0]
I'm trying to multiply them so that I only get the vectors within my cell S that corresponds to a 1 in the x vector.
Does anyone know a quick way to do this?

1 Comment

+1: This is my question of the week, because it has the cutest subject.

Sign in to comment.

 Accepted Answer

Fangjun Jiang
Fangjun Jiang on 22 Nov 2011
NewS=S(x)

2 Comments

NewS = S(logical(x));
Thank you very much!

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!