I can't output my data into excel in rows even though it is a 17x1 array

2 views (last 30 days)
Alexander Purvis
Alexander Purvis on 16 Nov 2021
Commented: Alexander Purvis on 17 Nov 2021
I have 6 data sets that are each 17x1 arrays. I want to output them to an .xlsx file and add names to the top of the columns. I have used the following code:
writetableA={'Hp','V0','fuel','RoC',textdelta,'\nu ';'(ft)','(kts)','(kg)','(fpm)','\circ','(kts)';HpA,TASA,FuelA,RoCoutputA,dA,vwA}
filename='Part1_GpA.xlsx';
writecell(writetableA,filename,'Sheet','Group_A','Range','A2')
When I open the .xlsx file everything is in columns. I tried to put HpA.',TASA.',FuelA,' etc. to transpose them but it didn't change anything.
On a side note how do I get the symbols to show as symbols?

Answers (1)

KSSV
KSSV on 16 Nov 2021
USe write2table. Read about it.
  3 Comments
Alexander Purvis
Alexander Purvis on 17 Nov 2021
Hi,
Thank you for your answer. I get why you sent that but it didn't help me entirely. I wanted to have the data in that format and be able to have a title+subtitle for each variable.
I used this code in the end:
filename='Part1_GpA.xlsx'; % Create .xlsx file
varNames={'Hp','V0','fuel','RoC','\delta','\nu '}; % Title of variables
tableA=table(HpA,TASA,FuelA,RoCoutputA,dA,vwA,'VariableNames',varNames); % Create table of values
tableAnew=tableA([1:1,1:end], :); % Add blank row as space for units
writetable(tableAnew,filename,'Sheet','Group_A','Range','A1') % Write newtable into .xlsx
varunits={'(ft)','(kts)','(kg)','(fpm)','\circ','(kts)'}; % Create array of unit names
writecell(varunits,filename,'Sheet','Group_A','Range','A2') % Write unit names into
Which outputted the data into excel, added a blank row and inserted a second set of data into it for the units. It's not elegent but it works.
Can you please tell me how I can get \nu and the other symbols to be outputted as such?

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!