Home > wafo > wsim > private > getulcc.m

getulcc

PURPOSE ^

Finds the upper left element > 0 in a matrix.

SYNOPSIS ^

[row,col,num]=getulcc(M)

DESCRIPTION ^

 GETULCC Finds the upper left element > 0 in a matrix.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

01 function [row,col,num]=getulcc(M)
02 %GETULCC Finds the upper left element > 0 in a matrix.
03 
04 %  Does not work if several element lay on a diagonal line and the upper left
05 %  element is not unique.
06 
07 %  Copyright 1993, Mats Frendahl, Dept. of Math. Stat., University of Lund.
08 
09 n=length(M);
10 for i=n-1:-1:0
11   index=find(diag(fliplr(M),i)>0);
12   if ~isempty(index)
13     row=index;
14     col=(n-i)-(row-1);
15     num=M(row,col);
16     return
17   end
18 end
19 
20

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003