Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Writing 2 vectors within matrix

2 visualizaciones (últimos 30 días)
Miguel Cardoso
Miguel Cardoso el 19 de Feb. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi!
I have 2 vectores I where are written the indexes of a matrix M and J which are the values that I want to write on matrix M. Bellow I give a generic example, how can I do it automatically?
I=[1 1 1 2 2 2 3 3 3];
J=[2 4 7 3 1 4 9 6 4];
M=[2 4 7; 3 1 4; 9 6 4];
Hope you can help me!

Respuestas (1)

fred  ssemwogerere
fred ssemwogerere el 19 de Feb. de 2020
Hello, use reshape
M=reshape(J,[3,3])';

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by