xlswrite over for loop
    6 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Hello,
I am trying to save a spreadsheet after my calculations with following code:
for j=1:numel(parameter_list)  
    %my code here
    %% writing output
        col_header={'Parameter_name','X','Y','Z'}; 
         row_header=Batch_name; 
         data=[X,Y,Z];     
           data_cells=num2cell(data);    
         output_matrix=[{' '} col_header; row_header Parameter_name data_cells];   
         xlswrite([basefolder '\' 'resultls.xlsx'],output_matrix);
end
Now what I am getting is the last paramter details of parameter_list but I want the output to store all the values of X,Y & Z over j=1:numel(parameter_list).
0 件のコメント
採用された回答
  meghannmarie
      
 2019 年 12 月 5 日
        
      編集済み: meghannmarie
      
 2019 年 12 月 5 日
  
      This will save out all the results in  one excel:
output_mat = cell(numel(parameter_list),5);
for j=1:numel(parameter_list)  
    %my code here
    %% writing output
         row_header=Batch_name; 
         data=[X,Y,Z];     
         data_cells = num2cell(data);    
         output_matrix(j,:) = [row_header Parameter_name data_cells];          
end
col_header={' ','Parameter_name','X','Y','Z'}; 
output_mat = [col_header;output_mat];
xlswrite([basefolder '\' 'resultls.xlsx'],output_matrix);
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Spreadsheets についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

