From 66a8bf6f809d9c1101880ccfc0d0189e9f258181 Mon Sep 17 00:00:00 2001 From: Erick Date: Wed, 13 Apr 2022 01:23:57 +0200 Subject: [PATCH] change filename --- interface/{init.m => interface.m} | 58 ++++++++++++++++++++++++++++++ interface/main.m | 59 ------------------------------- 2 files changed, 58 insertions(+), 59 deletions(-) rename interface/{init.m => interface.m} (57%) delete mode 100644 interface/main.m diff --git a/interface/init.m b/interface/interface.m similarity index 57% rename from interface/init.m rename to interface/interface.m index 48c7195..fd978fa 100644 --- a/interface/init.m +++ b/interface/interface.m @@ -1,3 +1,6 @@ +clear all; +clc; + %% File paths % VI-Grade init file paths fprintf('Initialization...\n') @@ -40,3 +43,58 @@ racetrack_rdf = 'roads.tbl\RaceTrack.rdf'; skidpad_drd = 'driver_roads.tbl\Skidpad.drd'; skidpad_rdf = 'roads.tbl\Skidpad.rdf'; accel_rdf = 'roads.tbl\Acceleration.rdf'; + +% note: useful function: +% coder.cinclude() allows to include a C file +% I like C ! :D + +%% Input arrays + +%% Outputs + +fprintf('Loading complete\n') + +%% Choose subsys test + +subsysIn = input('Subsystem: ', prompt) +% go back prompt here +subsystemSelect(subsysIn) + +%% Get file names and path + +[file_list, file_path] = uigetfile('xml', 'Choose the subsystem file', 'MultiSelect', 'on'); + +if iscell(file_list) == 0 + file_list = {file_list}; +end + +%% Ask subsystem test function +function subsystemSelect(subsys) +if(subsys <1 | subsys >) +switch subsystem + case +% stuff + +%% Test xml parsing function +function parseXML(IO, subsystem, sub_subsystem) + switch subsystem + case aeromap + fileRead = fileread(aeromap); + splitFile = regexp(A, '\n', 'split'); + case bumpstops + key(1,1) = {'CRTSprungMass'}; + key(2,1) = {'body'}; + attr(1) = {'CGHeight'}; + +%% test: read and write stuff function +if(IO == 'read') + % Set data to different value + newVal = 25 + newCG = bodyGetValue{systemStruct, key, newVal} +elseif(IO == 'write') + % Retrieve data from system file: key{tag, name}; attr(n)=attribute + CGHeight = bodyGetValue{systemStruct, key, attr} + +fprintf('Modified value: %s', CGHeight) %check if using %s is correct + +end \ No newline at end of file diff --git a/interface/main.m b/interface/main.m deleted file mode 100644 index 5b1b3de..0000000 --- a/interface/main.m +++ /dev/null @@ -1,59 +0,0 @@ -clear all; -clc; - -addpath('D:\Software Projects\matlab-vigrade-interfacing\interface'); % check if it actually imports everything - -% note: useful function: -% coder.cinclude() allows to include a C file -% I like C ! :D - -%% Input arrays - -%% Outputs - -fprintf('Loading complete\n') - -%% Choose subsys test - -subsysIn = input('Subsystem: ', prompt) -% go back prompt here -subsystemSelect(subsysIn) - -%% Get file names and path - -[file_list, file_path] = uigetfile('xml', 'Choose the subsystem file', 'MultiSelect', 'on'); - -if iscell(file_list) == 0 - file_list = {file_list}; -end - -%% Ask subsystem test function -function subsystemSelect(subsys) -if(subsys <1 | subsys >) -switch subsystem - case -% stuff - -%% Test xml parsing function -function parseXML(IO, subsystem, sub_subsystem) - switch subsystem - case aeromap - fileRead = fileread(aeromap); - splitFile = regexp(A, '\n', 'split'); - case bumpstops - key(1,1) = {'CRTSprungMass'}; - key(2,1) = {'body'}; - attr(1) = {'CGHeight'}; - -%% test: read and write stuff function -if(IO == 'read') - % Set data to different value - newVal = 25 - newCG = bodyGetValue{systemStruct, key, newVal} -elseif(IO == 'write') - % Retrieve data from system file: key{tag, name}; attr(n)=attribute - CGHeight = bodyGetValue{systemStruct, key, attr} - -fprintf('Modified value: %s', CGHeight) %check if using %s is correct - -end \ No newline at end of file