MATLAB Answers

How to save work space variables in excel with two more lines: names and unit

2 views (last 30 days)
Delia Bosshart
Delia Bosshart on 28 Jun 2021
Answered: Anagha Mittal on 28 Jun 2021
I'd like to save the output of my code as txt or xlsx file. What I don't manage to do is adding two more lines with names and units. Could someone help me out?
The output of my code are 22x1 doubles and I'd like to save it all in the same file.
%% Output parameters
T1 = [A; T1]; % Table 1: beta,st for each iteration step
T2 = [B; T2]; % Table 2: d_ch for each iteration step
T3 = [C; T3]; % Table 3; q_ch_max for each iteration step
T4 = [D; T4]; % Table 4; q_ch_mt for each iteration step
T5 = [E; T5]; % Table 5; q_vol for each iteration step
T6 = [F; T6]; % Table 6; q_reg for each iteration step
T7 = [G; T7]./0.9; % Table 7; q_inc for each iteration step
T8 = [H; T8]; % Table 8; q_loss for each iteration step
T9 = [T1, T2(:,2)] % Table 9; beta,st and d_ch for each iteration step
T10 = [T7,T8(:,2),T5(:,2),T3(:,2),T4(:,2),T6(:,2)] % Table 10; heat flux rates

Answers (1)

Anagha Mittal
Anagha Mittal on 28 Jun 2021
Hi Delia, you may try the command
save(filename,variables,fmt)
filename: The name of your Matlab file
variables: the list of variables you want to save
fmt: format of the file, for example for saving it as text you can write '-ascii'

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!