Add diagonal Value in cell array
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Tha saliem
el 11 de En. de 2018
Comentada: Tha saliem
el 11 de En. de 2018
hi
I have following array. I want to add NaN at diagonal position of each cell. LIKE x{1,1}, NaN will be added at x{1,1}(1,1).. for x{1,2}, NaN will be added at x{1,2}(1,2) & so on
x= {[0.79,0.31,0.24,0.71,0.1],[0.79,0.12,0.71,0.62,0.24]}
0 comentarios
Respuesta aceptada
Birdman
el 11 de En. de 2018
Editada: Birdman
el 11 de En. de 2018
for i=1:size(x,2)
x{1,i}(i)=NaN;
end
Type
x{1,:}
and see the result.
Más respuestas (0)
Ver también
Categorías
Más información sobre Operating on Diagonal 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!