cell problem

6 visualizaciones (últimos 30 días)
Andy
Andy el 27 de Sept. de 2011
this is my code:
zeromatrix = zero(size(vec), 1) mean(aaa) = zeromatrix
where vec is 2 million X 1 mean is a 2 by 1 cell aaa is just a counter, so in this case, it is a 1
when i try to run it, it gives me:
??? In an assignmnt A(I) = B, the number of elements in B and I must be the same
anyone have any idea how to get past this? thanks

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 27 de Sept. de 2011
size() returns 2 values.
mean() is a MATLAB function so not to use it as a variable name.
To assign a matrix to a cell array, you might want to use {}. A{1}=zeromatrix;
Use a small size vec to test out your code first and then make it 2 million by 1.
  4 comentarios
Fangjun Jiang
Fangjun Jiang el 27 de Sept. de 2011
name = cell(1,counter)
zeromatrix = zero(size(vec))
name{aaa} = zeromatrix
Andy
Andy el 27 de Sept. de 2011
thanks it worked!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by