Gistlib Logo

gistlib

examples of for cycle in matlab

main.m
% Example 1: Iterate over a vector
vector = [1, 3, 5, 7, 9];
for i = 1:length(vector)
    disp(vector(i));
end

% Example 2: Iterate for a fixed number of times
n = 5;
for i = 1:n
    disp(i);
end
197 chars
12 lines

similar matlab code snippets

how to calculate the maximum of a matrix in matlab
how to calculate the product of a matrix in matlab
how to calculate the first derivative of a function in matlab
how to calculate the derivative of a function in matlab
how to calculate the binomial distribution in matlab
how to calculate the gradient of a function in matlab
how to calculate the volume of a prism in matlab
how to calculate the area of a square in matlab
how to calculate the median of a matrix in matlab
find the slope of a set of points in matlab

related categories

matlab
programming

gistlibby LogSnag