From: Juliette Salexa on 22 Apr 2010 18:13 Is there a way to avoid the forloop here: for i=1:10000000 b(i)=matrix2num(a(i,:)); end ? Perhaps using cell arrays ?
From: Matt Fig on 22 Apr 2010 18:47 And what is MATRIX2NUM? I sure don't have it...
From: Roger Stafford on 22 Apr 2010 18:50 "Juliette Salexa" <juliette.physicist(a)gmail.com> wrote in message <hqqhm2$ipj$1(a)fred.mathworks.com>... > Is there a way to avoid the forloop here: > > for i=1:10000000 > b(i)=matrix2num(a(i,:)); > end > > ? > > Perhaps using cell arrays ? -------------------- n = size(a,2); b = a*10.^((n-1:-1:0).'); I am assuming your matrix2num is the one written by Aman Siddiqi at: http://www.mathworks.nl/matlabcentral/fileexchange/7264 which in this case converts decimal digits to decimal numbers. Roger Stafford
From: Matt Fig on 22 Apr 2010 18:55 Oh, if that is the case: % Data a = magic(3) % Engine b = sum(a.*repmat(10.^(size(a,2)-1:-1:0),size(a,1),1),2)
From: Matt Fig on 22 Apr 2010 18:57 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message > -------------------- > n = size(a,2); > b = a*10.^((n-1:-1:0).'); > Roger Stafford Much nicer!
|
Next
|
Last
Pages: 1 2 Prev: Subscripted assignment dimension mismatch on yahoo stocks Next: Error message about heatmap |