Writing Data to Excel file

7 views (last 30 days)
Ryan Cummings
Ryan Cummings on 6 Feb 2019
Edited: Shawn Duenas on 6 Feb 2019
V_rng = [0:0.001:27.7778];
%Vehicle Aerodynamic drag calculation and plot
Cd = 0.0145; % Aerodynamic Drag Coefficient
row = 1.1; % Density of air
A = 0.5; %projected Vehicle area
F_drag = double.empty;
index = 1;
for i = V_rng
F = 0.5* row * Cd * A * (i^2);
F_drag(index) = F;
index = index + 1;
subplot (2,2,1)
title('Aerodynamic Drag Vs Vehicle Velocity')
xlabel('Vehicle Velocity[m/s]')
ylabel('Vehicle Aerodynamic Drag Force [N]')
%writing values to excel file
xlswrite('forceValues', F_drag)
xlswrite('VelocityValues', V_rng)
The error im getting: Error using xlswrite (line 224)
The specified data range is invalid or too large to write to the specified file format. Try writing to an XLSX file and use Excel
A1 notation for the range argument, for example, ‘A1:D4’.
Error in Resistive_Forces_calculations (line 27)
xlswrite('forceValues', F_drag)

Answers (1)

Shawn Duenas
Shawn Duenas on 6 Feb 2019
Edited: Shawn Duenas on 6 Feb 2019
To print to different worksheets in the same spreadsheett:
xlswrite(myFile, F_drag, 'forceValues')
xlswrite(myFile, V_rng, 'VelocityValues')
to print to new spreadsheets, add '.xls' to end of file name.
xlswrite('forceValues.xlsx', F_drag)
xlswrite('VelocityValues.xlsx', V_rng)




Community Treasure Hunt

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

Start Hunting!