How to change ylabels in a for loop

Illustration
Gracesmith97 - 2020-09-01T10:49:12+00:00
Question: How to change ylabels in a for loop

Hello everyone, I have a simple for loop to plot 7 different plots, but the ylabel should be different.   for k=1:7; figure bar(GAMMA_sta(k,:)) xlabel('Rock Types'); title( [ 'Statistics of Rocks', num2str(k)] ); end Anyone knows how to change ylabel for each plot in a for loop please let me know. Thanks. My 7 plots should have 7 different ylabels.

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

For example,

 

ylabel(sprintf('Plot #%d', k))

It would be easier if you indicated how you want the different ylabel to look.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!