index and matrix selection

Hi,
my index matrixis size(index)=118*4. the data matrix is size(data)=2970290*9
iwa nt to select just index-data.
i wrote this:
data_new=data([index],:). the size of this matrix is:472*9.
I want to get the matrix with the size 118*36. I dont want to use reshape. do you know something better than my statement (data_new=data([index],:))
Thanks

 채택된 답변

José-Luis
José-Luis 2012년 11월 12일

0 개 추천

cell2mat(arrayfun(@(x) {data(x,:)},index,'uniformoutput',false));
Using reshape should be faster though.

추가 답변 (0개)

카테고리

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

질문:

2012년 11월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by