Azzera filtri
Azzera filtri

How to overwrite pars of a cell array?

1 visualizzazione (ultimi 30 giorni)
Kyle Reagan
Kyle Reagan il 23 Giu 2017
Risposto: Andrei Bobrov il 23 Giu 2017
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_?

Risposte (1)

Andrei Bobrov
Andrei Bobrov il 23 Giu 2017
k = ['full'
'zero'
'zero'
'zero'
'zero'
'zero'
'zero'
'zero'
'zero'];
out = circshift(k,8);

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by