Borrar filtros
Borrar filtros

generating n random matrices

1 visualización (últimos 30 días)
Offroad Jeep
Offroad Jeep el 12 de Sept. de 2015
Comentada: Steven Lord el 17 de Mayo de 2016
Hi to all , I want to generate matrices with the following code.
nmc = 1000
matrices(1:nmc) = rand(3,3,nmc)
I want to generate 1000 random matrices of 3x3.
Regards

Respuesta aceptada

Image Analyst
Image Analyst el 12 de Sept. de 2015
How about
nmc = 1000
matrices = rand(3,3, nmc);
To get any one particular 3x3 matrix, just extract it out of the 3D array by specifying the plane. For example to get the 10th matrix:
one3x3 = matrices(:,:, 10);
  2 comentarios
Offroad Jeep
Offroad Jeep el 17 de Mayo de 2016
Not working
Steven Lord
Steven Lord el 17 de Mayo de 2016
Works fine for me. Can you elaborate a little bit on what "not working" means -- does it throw an error (and if so, what is the FULL, EXACT text of that error), does it issue a warning (again, FULL EXACT text), does it not satisfy some other requirement you have, etc.?

Iniciar sesión para comentar.

Más respuestas (1)

Categorías

Más información sobre MATLAB Coder 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!

Translated by