X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Message-ID: <37470BA0.9DCF9DEB@concentric.net> Date: Sat, 22 May 1999 15:55:12 -0400 From: Eric Durant X-Mailer: Mozilla 4.5 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.soft-sys.matlab Subject: Re: Matrix Dimension??? References: <374731AF.8D98DDA@egnatia.ee.auth.gr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Xristos Pappas wrote: > I have the following code in FORTRAN > DO 100 J = 1,16 > DO 200 K = 1,32768 > J1=(K-1)*16+J [...] > and i took an error message because of different matrix dimmension. > How can i cope with this code lines of FORTRAN??? MatLab supports multidimensional arrays natively, so, unless some aspect of your algorithm greatly benefits from it, you are probably better off not manually doing the 2-D to 1-D indexing conversion. If you must use a 1-D array and do the indexing conversion, perhaps it would be better to use the MatLab function sub2ind() to make the code a bit more readable: >> siz=[16 32768]; >> % ... iterate over J and K >> J1=sub2ind(siz,J,K); -- Eric Durant --- Website: http://www.edurant.com/ ICQ: 9118339