필터 지우기
필터 지우기

Problem with cell array

조회 수: 1 (최근 30일)
cemsi888
cemsi888 2015년 8월 17일
댓글: Star Strider 2015년 8월 17일
Hi everyone. Today i have one more question too. ı have position vector which gives me Information about number of elements. but ı would like to reach these numbers. ı created cell arrays to store them in it. But ın cell array ı can see just the last cell array. the other cells are empty. Could you please Help me? her my codes
for ii = 1:length(binvalue)
MinStep = sum(diff(bwts_export.m_pkt_V_red{ii}(1:1:end)))*inp.streuung/100;
[posi, ~] = find(abs(diff(bwts_export.m_pkt_V_red{ii}))>MinStep);
zahlen=cell(length(binvalue),1)
zahlen{ii}=posi
end
  댓글 수: 1
cemsi888
cemsi888 2015년 8월 17일
Any idea ?

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

답변 (1개)

Star Strider
Star Strider 2015년 8월 17일
I can’t run your code, but my best guess is to delete this line:
zahlen=cell(length(binvalue),1)
You are preallocating the same array inside the loop each time, overwriting all previous values of ‘zahlen’. Preallocate before the loop.
  댓글 수: 2
cemsi888
cemsi888 2015년 8월 17일
thanx a lot . you are right
Star Strider
Star Strider 2015년 8월 17일
My pleasure.
If my Answer solved your problem, please Accept it.

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by