Borrar filtros
Borrar filtros

How to generate data using for loop and save in rows in MATLAB

3 visualizaciones (últimos 30 días)
Med Future
Med Future el 4 de Mzo. de 2022
Editada: Davide Masiello el 4 de Mzo. de 2022
Hello every one i hope you are doing well.
I have the following code which generate data.
i want it to run for 100 times and saves results in rows
like loop is 100 and output should be 100 rows
Repeat=randi([1 1000], 1, 5);
prf=randi([1 1000], 1,5);
DS =repelem(prf,Repeat);
scatter(1:length(DS(1,:)),DS(1,:))

Respuestas (1)

Davide Masiello
Davide Masiello el 4 de Mzo. de 2022
Editada: Davide Masiello el 4 de Mzo. de 2022
Something like this?
clear,clc
Repeat=randi([1 1000], 1, 10);
for i=1:200
prf=randi([1 1000], 1,10);
DS(i,:) =repelem(prf,Repeat);
plot(1:size(DS,2),DS(i,:))
hold on
end
  8 comentarios
Davide Masiello
Davide Masiello el 4 de Mzo. de 2022
Editada: Davide Masiello el 4 de Mzo. de 2022
Still not sure what you mean, but I have edited my answer, please see if it sorts out your problem.

Iniciar sesión para comentar.

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by