From 16f456b0d56de7e71b959fb6e604ab819d8d06b9 Mon Sep 17 00:00:00 2001 From: Erick Date: Wed, 13 Apr 2022 01:03:43 +0200 Subject: [PATCH] testing functions --- interface/main.m | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 interface/main.m diff --git a/interface/main.m b/interface/main.m new file mode 100644 index 0000000..5b1b3de --- /dev/null +++ b/interface/main.m @@ -0,0 +1,59 @@ +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