matrix to struct do not match

조회 수: 2 (최근 30일)
Ihaveaquest
Ihaveaquest 2022년 9월 15일
댓글: Ihaveaquest 2022년 9월 15일
54X2 and ch1 row size fluctuates
i have them in a B size loop
when ch1 is size 54X6 it works fine when it changes to 52X6 it crashes
its there a modification for it to tranfer the data even if its not the same size ??
comp.post(:,B) = ch1(:,1);

채택된 답변

James Tursa
James Tursa 2022년 9월 15일
You should really show us all of the actual code in question, not just a wordy description of the code. A better description and your actual code would help us to advise you. The following might work for you, but it might leave old data in spots not set which might not be good.
comp.post(1:size(ch1,1),B) = ch1(:,1);
Maybe you would have to do something like this also:
comp.post(size(ch1,1)+1:end,B) = 0;
Again, hard to say what will actually work for you without knowing more about your problem.
  댓글 수: 1
Ihaveaquest
Ihaveaquest 2022년 9월 15일
comp.post(1:size(ch1,1),B) = ch1(:,1);
Thank you works like a charm!

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

추가 답변 (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