Loop example in MATLAB

Loop example in MATLAB

function [ output_args ] = Untitled( input_args )
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here
A= [ 1 2 3; 4 5 6; 7 8 9];
[x,y]=size(A);
K=1;
for i=1:x
    for j=1:y
        C(K) = A(i,j);
        K=K+1;
        
    end;
    end;
   A
   C
end

Output:

A =

1 2 3
4 5 6
7 8 9
C =

1 2 3 4 5 6 7 8 9

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *