created function
This commit is contained in:
+5
-17
@@ -1,27 +1,15 @@
|
|||||||
clear;
|
clear;
|
||||||
clc;
|
clc;
|
||||||
|
|
||||||
prompt = 'Initializing exporting';
|
prompt = 'Press "0" for front or "1" for rear: ';
|
||||||
str = input(prompt,'s');
|
side = input(prompt, 's');
|
||||||
|
|
||||||
if str == F
|
selectSide(side);
|
||||||
content = who('-file', 'M22H_FrontSuspension_Data.mat');
|
|
||||||
filename = 'FrontSuspension_Exported.xlsx';
|
|
||||||
elseif str == R
|
|
||||||
content = who('-file', 'M22H_RearSuspension_Data.mat');
|
|
||||||
filename = 'RearSuspension_Exported.xlsx';
|
|
||||||
|
|
||||||
fprintf('Initializing exporting process');
|
fprintf('Initializing exporting process');
|
||||||
|
|
||||||
for i=1:length(content)
|
for i=1:length(content)
|
||||||
writetable(content, filename, 'Sheet', 'Front', 'WriteVariableNames', true);
|
writetable(content, filename, 'Sheet', sheetName, 'WriteVariableNames', true);
|
||||||
|
|
||||||
quit = input('s');
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
fprintf('Finished exporting')
|
fprintf('Finished exporting')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-17
@@ -1,27 +1,15 @@
|
|||||||
clear;
|
clear;
|
||||||
clc;
|
clc;
|
||||||
|
|
||||||
prompt = 'Press F for front or R for rear';
|
prompt = 'Press "1" for front or "2" for rear: ';
|
||||||
str = input(prompt,'s');
|
side = input(prompt, 's');
|
||||||
|
|
||||||
if str == F
|
selectSide(side);
|
||||||
content = who('-file', 'M22H_FrontSuspension_Data.mat');
|
|
||||||
filename = 'FrontSuspension_Exported.xlsx';
|
|
||||||
sheetName = 'Front';
|
|
||||||
elseif str == R
|
|
||||||
content = who('-file', 'M22H_RearSuspension_Data.mat');
|
|
||||||
filename = 'RearSuspension_Exported.xlsx';
|
|
||||||
sheetName = 'Rear';
|
|
||||||
|
|
||||||
fprintf('Initializing exporting process');
|
fprintf('Initializing exporting process \n');
|
||||||
|
|
||||||
for i=1:length(content)
|
for i=1:length(content)
|
||||||
writetable(content, filename, 'Sheet', sheetName, 'WriteVariableNames', true);
|
writetable(content, filename, 'Sheet', sheetName, 'WriteVariableNames', true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
fprintf('Finished exporting')
|
fprintf('Finished exporting')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
function [content, filename, sheetName] = selectSide(input);
|
||||||
|
|
||||||
|
%0 is front, 1 is rear
|
||||||
|
|
||||||
|
if rem(input, 2) == 0
|
||||||
|
content = who('-file', 'M22H_FrontSuspension_Data.mat');
|
||||||
|
filename = 'FrontSuspension_Exported.xlsx';
|
||||||
|
sheetName = 'Front';
|
||||||
|
elseif input/2 != 0
|
||||||
|
content = who('-file', 'M22H_RearSuspension_Data.mat');
|
||||||
|
filename = 'RearSuspension_Exported.xlsx';
|
||||||
|
sheetName = 'Rear';
|
||||||
|
else
|
||||||
|
fprintf = 'Input must be "front" or "rear";
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
function [content, filename, sheetName] = selectSide(input);
|
||||||
|
|
||||||
|
%input 1 is front, 2 is rear
|
||||||
|
|
||||||
|
if rem(input, 2) == 0
|
||||||
|
content = who('-file', 'M22H_FrontSuspension_Data.mat');
|
||||||
|
filename = 'FrontSuspension_Exported.xlsx';
|
||||||
|
sheetName = 'Front';
|
||||||
|
elseif rem(input, 2) ~= 0
|
||||||
|
content = who('-file', 'M22H_RearSuspension_Data.mat');
|
||||||
|
filename = 'RearSuspension_Exported.xlsx';
|
||||||
|
sheetName = 'Rear';
|
||||||
|
else
|
||||||
|
fprintf = 'An error occured!';
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user