matlab - Add sequential row names into a table created using a for-loop -


i wrote following program create table combt. trying add rows names table no luck. want add new column containing row names , each row named sequentially i.e. (['row' num2str(j)])

%% create tables. combt = [];  %% loop. = [224:231, 271:281];     j = sprintf('%04d', i)  %% name fit results sequentially. comb.(['comb' j]) = cfit(fitresult);  %% export combined variables table. combt = [combt;comb.(['comb' j])];  end  %% name columns. final = dataset({combt 'a','b','c','d','wa','wb','wc','wd','xa','xb','xc','xd','y0','rsquare'}); 

the current table looks this:

the current table looks this

i need (the row names can achieved (['row' num2str(j)])):

i need this

if want initialize combt variable different names this.

%% loop. = [224:231, 271:281];     j = sprintf('%04d', i)      %% export combined variables table.     combt.(['comb' j])]=[];  end 

if want give names entries this:

aaa=1:10; i=1:length(aaa)     names{i}=['c',num2str(i)]; end aaa_dataset = dataset(aaa','obsnames',names) 

in case (make sure have name each entry):

final = dataset(combt,'obsnames',{'a','b','c','d','wa','wb','wc','wd','xa','xb','xc','xd','y0','rsquare'}); 

if want names added matrix:

a=rand(10,10); i=1:10     names{i}=['c',num2str(i)]; end  a_cell=cell(size(a,1),size(a,2)+1); a_cell(1:end,2:end)=num2cell(a); a_cell(1:end,1)=names 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -