Assignment has more non-singleton rhs dimensions than non-singleton subscripts
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi guys,
I am a Matlab newbie. I am trying to squeeze elements from a 3-dimensional matrix on to a 2-dimensional matrix. The size of my 3 dimensional matrix is 11 * 11 * 2871, and it is essentially a variance-covariance matrix with variace reported on the diagonal and covariance appearing on off-diagonals. I am running the following code but it results in the following error
"Assignment has more non-singleton rhs dimensions than non-singleton subscripts"
for i= 1:11
for j = 2:11
corr(i,j) = squeeze(HT(i,j,:))
end
end
Any help would be appreciated. Thanks!
3 comentarios
Obaidur Rehman
el 9 de Sept. de 2017
Editada: Obaidur Rehman
el 9 de Sept. de 2017
José-Luis
el 9 de Sept. de 2017
I don't get why you need a loop. Why don't you just index the values you need.
Respuestas (1)
KSSV
el 9 de Sept. de 2017
That error appears when you try to store a n dimension in a initialized data which is dimensioned different to n. You try replacing line:
corr(1,2,:) = squeeze(HT(1,2,:))
With exact dimensions of RHS or initialize LHS as a cell.
corr{1,2} = squeeze(HT(1,2,:))
1 comentario
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!