How to generate data using for loop and save in rows in MATLAB
조회 수: 2 (최근 30일)
이전 댓글 표시
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,:))
댓글 수: 0
답변 (1개)
Davide Masiello
2022년 3월 4일
편집: Davide Masiello
2022년 3월 4일
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
Davide Masiello
2022년 3월 4일
편집: Davide Masiello
2022년 3월 4일
Still not sure what you mean, but I have edited my answer, please see if it sorts out your problem.
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!