Writing Data to Excel file

4 次查看(过去 30 天)
Ryan Cummings
Ryan Cummings 2019-2-6
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;
end
subplot (2,2,1)
title('Aerodynamic Drag Vs Vehicle Velocity')
plot(V_rng,F_drag)
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)

回答(1 个)

Shawn Duenas
Shawn Duenas 2019-2-6
编辑:Shawn Duenas 2019-2-6
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)

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by