Prev: importing into Excel
Next: xcorr2 Data Location
From: Ender on 30 Jul 2010 11:33 I have followed MatLab's example for writing to an Excel file, but for some reason MatLab will not write my data into the rows. ex: Turbo_mass_system = [12;15;45;6]; Turbo_Power = [24;78;95;35] % Write the data to Excel data_out = {'Mass', 'Turbine Power';Turbo_mass_system,Turbo_Power}; xlswrite('Power_Scaling.xls',data_out,'Power Scaling for Turbines'); Whenever I open up my excel spreadsheet, the column names are displayed however the data is not. My actual data are two 14 x 1 matrices, but I wrote this short code for this message. MatLab will not write the data for my shorter matrices either. Thanks, --Ender--
From: Andy on 30 Jul 2010 11:49 "Ender " <jr147(a)msstate.edu> wrote in message <i2urbg$s93$1(a)fred.mathworks.com>... > I have followed MatLab's example for writing to an Excel file, but for some reason MatLab will not write my data into the rows. > > ex: > Turbo_mass_system = [12;15;45;6]; > Turbo_Power = [24;78;95;35] > > % Write the data to Excel > data_out = {'Mass', 'Turbine Power';Turbo_mass_system,Turbo_Power}; > xlswrite('Power_Scaling.xls',data_out,'Power Scaling for Turbines'); > > Whenever I open up my excel spreadsheet, the column names are displayed however the data is not. My actual data are two 14 x 1 matrices, but I wrote this short code for this message. MatLab will not write the data for my shorter matrices either. > > Thanks, > > --Ender-- Try something like: data_out = {'Mass' 'Turbine Power'; num2cell(Turbo_mass_system) num2cell(Turbo_Power)}; Alternatively, write the headers separately from the data: headers = {'Mass' 'Turbine Power'}; data = [Turbo_mass_system Turbo_Power]; xlswrite('Power_Scaling.xls',headers); xlswrite('Power_Scaling.xls',data,'A2:B15');
From: Ender on 30 Jul 2010 12:48 "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i2us9g$soo$1(a)fred.mathworks.com>... > "Ender " <jr147(a)msstate.edu> wrote in message <i2urbg$s93$1(a)fred.mathworks.com>... > > I have followed MatLab's example for writing to an Excel file, but for some reason MatLab will not write my data into the rows. > > > > ex: > > Turbo_mass_system = [12;15;45;6]; > > Turbo_Power = [24;78;95;35] > > > > % Write the data to Excel > > data_out = {'Mass', 'Turbine Power';Turbo_mass_system,Turbo_Power}; > > xlswrite('Power_Scaling.xls',data_out,'Power Scaling for Turbines'); > > > > Whenever I open up my excel spreadsheet, the column names are displayed however the data is not. My actual data are two 14 x 1 matrices, but I wrote this short code for this message. MatLab will not write the data for my shorter matrices either. > > > > Thanks, > > > > --Ender-- > > Try something like: > > data_out = {'Mass' 'Turbine Power'; > num2cell(Turbo_mass_system) num2cell(Turbo_Power)}; > > Alternatively, write the headers separately from the data: > > headers = {'Mass' 'Turbine Power'}; > data = [Turbo_mass_system Turbo_Power]; > xlswrite('Power_Scaling.xls',headers); > xlswrite('Power_Scaling.xls',data,'A2:B15'); Thanks, The first method using num2cell did not work, but the second method did.
|
Pages: 1 Prev: importing into Excel Next: xcorr2 Data Location |