필터 지우기
필터 지우기

How to overwrite pars of a cell array?

조회 수: 1 (최근 30일)
Kyle Reagan
Kyle Reagan 2017년 6월 23일
답변: Andrei Bobrov 2017년 6월 23일
I have a 9x1 cell array composed of strings that looks as follows.
k = [full...
zero
zero
zero
zero
zero
zero
zero
zero]
I'm getting values for k in a for loop that undergoes 2 iterations. For the second iteration, k(8) = full and the other 8 entries are all zero. How do I prevent k from being rewritten to look like
k = [zero ...
zero
zero
zero
zero
zero
zero
full
zero]
and instead have the first and eighth entry both say _full_ while the other seven entries say _zero_?

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2017년 6월 23일
k = ['full'
'zero'
'zero'
'zero'
'zero'
'zero'
'zero'
'zero'
'zero'];
out = circshift(k,8);

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by