필터 지우기
필터 지우기

Help most definitely needed :) Indexing struct arrays for rows with specified values

조회 수: 1 (최근 30일)
Hi everyone,
I have a struct array that has 35 cell arrays within it, each having 7 matrices (1.3 million x 1). I am trying to index the rows with a value of 4 within the second matrix ( MyData(1,n).data{1,2} ) and do this for all 35 cell arrays and place it into a new cell array. No success is coming my way.
So far for the indexing I have this but I keep getting the error of ??? Index exceeds matrix dimensions:
stid = 4;
colmn = 2;
p1 = MyDataToo(1,1).data{MyDataToo(1,1).data{:,colmn} == stid, :};
I want to figure this out before I even move on to making it a loop to then do this for the other 34 cell arrays in the struct.
Help most certainly needed!!

채택된 답변

Walter Roberson
Walter Roberson 2014년 2월 21일
Try
p1 = MyDataToo(1,1).data([MyDataToo(1,1).data{:,colmn}] == stid, :);
  댓글 수: 1
mashtine
mashtine 2014년 2월 24일
Thanks Walter,
Any idea how I would then do this within a loop for the other yearly cell arrays within the struct?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by