for i=1:length(ytick) in matlab

The for loop in Matlab is used to iterate over a range of numeric values. The length function can be used to determine the number of elements in a given array.

To loop through the elements of ytick array, the syntax would be:

main.m
for i=1:length(ytick)
     % code to be executed for each element in ytick
     % you can access the i-th element of ytick using ytick(i)
end
142 chars
5 lines

This will execute the code within the loop for each element in ytick, from the first element (i = 1) to the last element (i = length(ytick)).

related categories

gistlibby LogSnag