Bug or restriction with matrices?

Lucio Agostinho Rocha outrosdiasvirao at yahoo.com.br
Fri Jun 5 04:35:32 CEST 2009


Hi,

I'm working with matrices and I observed this strange behavior. I'd like to acquire as result a matrix with ten lines and ten columns. Then, I tried two things:

//---Start program
clear;
m=zeros(10,10);
function [] = test()
    
  test1(m);
  
  m(5,1)=1;
  disp(m);
endfunction

function [] = test1(m)
  
  m(5,1)=1;
  disp(m);
  
endfunction

//---End program

When I use 'test1' function I acquire the expected result, but when I use only 'test' function, considering 'm' as global, the attribution 'cut' my matrix. Why this occurs?

Thanks in advance,

Lucio
.....


      Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com



More information about the users mailing list