Concatenate fields of two different structures based on two conditions results in Index exceeds array bound help!
조회 수: 1 (최근 30일)
이전 댓글 표시
I have two structures with Struct1(1 by 40) fields Date and Time (scalars), and Struct2(1 by 100) fields Date1 and Time1 which are vectors. Now I want to attach the fields Date1 and Time1 in struct2 to struct1 if Date=Date1, and Time=Time1. Notice one is scalar and other is vector. My code is as follows. But i get the error as Index in position 1 exceeds array bounds.
Any suggestion is highly appreciated !!!
StartTime=[];
for ii = 1: length(Struct1)
for jj = 1: length(Struct2)
for kk = 1: length(Struct2(ii).Time1)
if Struct1(ii).Date==Struct2(jj).Date1(kk,1) || abs(Struct1(ii).Time - Struct2(jj).Time1(kk,1)) <= 3000
Struct1(ii).StartTime(kk,1) = vertcat(StartTime,Struct2(jj).Time1(kk,1)) ;
else jj = jj+1;
end
end
end
end
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!