Prev: repair script
Next: tcpip (conncetion timed out)
From: us on 17 Jun 2010 05:53 Oscar Lopez <oslo.garcia(a)gmail.com> wrote in message <f5775e1b-4165-41c6-b723-8d6691a75b15(a)q12g2000yqj.googlegroups.com>... > I have several functions which depend on three variables. Each > variable is stored in a vector and the function is computed by looping > over the three vectors. > > I am thinking in the best way of storing the information from a > programming and performance point of view. Two possibilities come to > my mind: > > 1. Matrix with three indexes A(i,j,k) > 2. Cell vector in which every element of the cell is a matrix with two > indexes A{i}(j,k) > > What is the MATLAB recommended way of programming this situation? Are > there any recommendations regarding three index matrices or cells? > > TIA use #1 whenever possible... us
From: Thomas Britton on 17 Jun 2010 06:59 #1 is indexed faster Ideally you want to cycle along the columns rather than the rows (as matlab is column based). However if you are having memory issues #2 may help you. Each 'bucket' of the cell is stored as a separate contiguous array. "us " <us(a)neurol.unizh.ch> wrote in message <hvcr9v$78a$1(a)fred.mathworks.com>... > Oscar Lopez <oslo.garcia(a)gmail.com> wrote in message <f5775e1b-4165-41c6-b723-8d6691a75b15(a)q12g2000yqj.googlegroups.com>... > > I have several functions which depend on three variables. Each > > variable is stored in a vector and the function is computed by looping > > over the three vectors. > > > > I am thinking in the best way of storing the information from a > > programming and performance point of view. Two possibilities come to > > my mind: > > > > 1. Matrix with three indexes A(i,j,k) > > 2. Cell vector in which every element of the cell is a matrix with two > > indexes A{i}(j,k) > > > > What is the MATLAB recommended way of programming this situation? Are > > there any recommendations regarding three index matrices or cells? > > > > TIA > > use #1 whenever possible... > > us
|
Pages: 1 Prev: repair script Next: tcpip (conncetion timed out) |