Matlab programmingSolutionFollowing matlab code should do th

Matlab programming

Solution

Following matlab code should do the job:

function [out] = extractSeq4( r, c, mat )
    [ totalRows, totalCols ] = size( mat );
    out = [];
    if r > totalRows
        fprintf(\'Error: the given r exceeds the number of rows.\ \');
    elseif c > totalCols
        fprintf(\'Error: the given c exceeds the number of columns.\ \');
    elseif ( c + 3 > totalCols )
        fprintf(\'Error: Not enough numbers to make a sequence.\ \');
    else
        out = [ mat(r,c) , mat(r,c+1), mat(r,c+2), mat(r,c+3) ];
    end

end

Matlab programmingSolutionFollowing matlab code should do the job: function [out] = extractSeq4( r, c, mat ) [ totalRows, totalCols ] = size( mat ); out = []; i

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site