MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

 Subject: Programming question From: Chris Date: 21 Jan, 2010 15:45:08 Message: 1 of 5 Dear all, I need some help on the following issue: Say I have 10 LLFs variables such that LLF1=3.3, LLF2=4.3,...,LLF10=5.4 and I need to estimate 10 different AIC and BIC tests such that [AIC1,BIC1]=(LLF1,1000,4); [AIC2,BIC2]=(LLF2,1000,4); ... [AIC10,BIC10]=(LLF10,1000,4); I need to do this with a for loop but I can't figure out how to tell matlab to create the output variables AICi and BICi variables and use the LLFi variable as inputs, I though that I should do something like: for n=1:10 [AIC{'n'},BIC{'n'}]=(LLF{'n'},1000,4); end but it doesn't work. Thank you for your help!
 Subject: Programming question Date: 21 Jan, 2010 15:49:18 Message: 2 of 5 "Chris" writes: >Dear all, >I need some help use cells if you can, or type    help eval and look at the example
 Subject: Programming question From: Chris Date: 21 Jan, 2010 18:19:05 Message: 3 of 5 tpl@eng.cam.ac.uk (Tim Love) wrote in message ... > "Chris" writes: > > >Dear all, > > >I need some help > use cells if you can, or type > help eval > and look at the example I did the following with nesting an eval into another eval, for n=1:2 D={'LLF1';'LLF2';'LLF3';'LLF4';'LLF5';'LLF6';'LLF7';'LLF8';'LLF9';'LLF10';} eval(['AIC' num2str(n) '=aicbic(eval(D{n}),1000,2)']) end however, I do not know how to estimate the BICi variable. Additionally, writing all these LLFs into the D matrix seems to be bad coding. I would be grateful If you have any suggestions on coding this in a clearer manner...
 Subject: Programming question From: Nathan Date: 21 Jan, 2010 18:23:23 Message: 4 of 5 On Jan 21, 10:19 am, "Chris" wrote: > t...@eng.cam.ac.uk (Tim Love) wrote in message ... > > "Chris" writes: > > > >Dear all, > > > >I need some help > > use cells if you can, or type > >    help eval > > and look at the example > > I did the following with nesting an eval into another eval, > for n=1:2 > D={'LLF1';'LLF2';'LLF3';'LLF4';'LLF5';'LLF6';'LLF7';'LLF8';'LLF9';'LLF10';} > eval(['AIC' num2str(n) '=aicbic(eval(D{n}),1000,2)']) > end > > however, I do not know how to estimate the BICi variable. > > Additionally, writing all these LLFs into the D matrix seems to be bad coding. I would be grateful If you have any suggestions on coding this in a clearer manner... Use a cell array or structure rather than creating multiple variables. See MATLAB FAQ 6.4: http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F -Nathan
 Subject: Programming question From: Steven Lord Date: 21 Jan, 2010 18:29:28 Message: 5 of 5 "Chris" wrote in message news:hja5qp\$1dp\$1@fred.mathworks.com... > tpl@eng.cam.ac.uk (Tim Love) wrote in message > ... >> "Chris" writes: >> >> >Dear all, >> >> >I need some help >> use cells if you can, or type help eval >> and look at the example > I did the following with nesting an eval into another eval, > for n=1:2 > D={'LLF1';'LLF2';'LLF3';'LLF4';'LLF5';'LLF6';'LLF7';'LLF8';'LLF9';'LLF10';} > eval(['AIC' num2str(n) '=aicbic(eval(D{n}),1000,2)']) > end > > however, I do not know how to estimate the BICi variable. > Additionally, writing all these LLFs into the D matrix seems to be bad > coding. I would be grateful If you have any suggestions on coding this in > a clearer manner... See Q4.6 in the newsgroup FAQ for some suggestions of alternative ways to accomplish what you want. -- Steve Lord slord@mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ