I have a for loop of 800000 iterations, it graphs some data everytime the module of this data divided by 1000 is 0, I need the graph to have multiple of the graphed curves.

1 view (last 30 days)
Here's my section of code:
if mod(q,1000) == 0
y3 = histcounts(p,binEdges);
plot(y3);
hold on
end

Accepted Answer

Cris LaPierre
Cris LaPierre on 20 Oct 2022
Edited: Cris LaPierre on 20 Oct 2022
Your code works for me, although I had to build up a lot of the surrounding code, inferring what it should be from what you said.
binEdges = 0:0.1:1;
for q = 1:800000
p = rand(1000,1);
if mod(q,1000) == 0
y3 = histcounts(p,binEdges);
plot(y3);
hold on
end
end
  1 Comment
Enrique González
Enrique González on 21 Oct 2022
Hi yes, this is exaclty what I needed, and indeed I had a much bigger block of code, including the for loop, I didn't include since it was very long. Thank you so much.

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!