From 77162b3c3aeace5276d1460ff4c2bc6440e8e44b Mon Sep 17 00:00:00 2001 From: Erick Date: Mon, 31 Jan 2022 22:49:31 +0100 Subject: [PATCH] update selectSide() algorithm, fix plot.m --- test.m => mat2csv.m | 8 -------- plot.asv | 12 ++++++++++++ plot.m | 15 +++++++++++++-- selectSide.m | 4 +++- 4 files changed, 28 insertions(+), 11 deletions(-) rename test.m => mat2csv.m (70%) create mode 100644 plot.asv diff --git a/test.m b/mat2csv.m similarity index 70% rename from test.m rename to mat2csv.m index dee2569..afa2a18 100644 --- a/test.m +++ b/mat2csv.m @@ -1,14 +1,6 @@ selectSide(front); %selectSide(rear); -if carSide == 'front' - FileData = load('M22H_FrontSuspension_Data.mat'); -elseif carSide == 'rear' - FileData = load('M22H_RearSuspension_Data.mat'); -else - error('Error: %s is not a valid input', carSide) -end - fields = fieldnames(FileData); fields = fieldnames(FileData); for K = 1 : length(fields) diff --git a/plot.asv b/plot.asv new file mode 100644 index 0000000..b97afe1 --- /dev/null +++ b/plot.asv @@ -0,0 +1,12 @@ +selectSide('front'); +%selectSide('rear'); + +% left and right data are identical +% this piece of code works regardless of car side +camber = fplot(CamberLeft) +toe = fplot(ToeLeft) +caster = fplot(CasterLeft) +kpi = fplot(KingpinLeft) +AntiDiveLeft = + +ackermann diff --git a/plot.m b/plot.m index c698f19..c413b08 100644 --- a/plot.m +++ b/plot.m @@ -1,3 +1,14 @@ -load('M22H_RearSuspension_Data.mat'); +selectSide('front'); +%selectSide('rear'); -f = fplot(CamberLeft) \ No newline at end of file +% left and right data are identical +% this piece of code works regardless of car side +camber = fplot(CamberLeft) +toe = fplot(ToeLeft) +caster = fplot(CasterLeft) +kpi = fplot(KingpinLeft) +antidive = fplot(AntiDiveLeft) + +if carSide == 'front' + Ackermann = fplot(AckermannLeft) +end diff --git a/selectSide.m b/selectSide.m index a02ba77..bafec11 100644 --- a/selectSide.m +++ b/selectSide.m @@ -6,8 +6,10 @@ fileName = 'SuspensionData_Exported.xlsx'; if rem(input, 2) == 1 carSide = 'front'; + FileData = load('M22H_FrontSuspension_Data.mat'); elseif rem(input, 2) == 0 carSide = 'rear'; + FileData = load('M22H_RearSuspension_Data.mat'); else - fprintf = 'An error occured!'; + error('Error: %s is not a valid input', carSide) end; \ No newline at end of file