diff --git a/scripts/getSubdirectories.m b/scripts/getSubdirectories.m new file mode 100644 index 0000000..477e4b5 --- /dev/null +++ b/scripts/getSubdirectories.m @@ -0,0 +1,15 @@ +function subdirectories = getSubdirectories(directoryPath) + % Check if the input is a valid directory + if ~isfolder(directoryPath) + error('Input is not a valid directory.'); + end + + % Get a list of all items in the directory + items = dir(directoryPath); + + % Filter out non-directory items + subdirectories = {items([items.isdir]).name}; + + % Remove '.' and '..' from the list + subdirectories = subdirectories(~ismember(subdirectories, {'.', '..'})); +end diff --git a/scripts/similarities.m b/scripts/similarities.m new file mode 100644 index 0000000..ed0a591 --- /dev/null +++ b/scripts/similarities.m @@ -0,0 +1,38 @@ +%% please open Magic Formular APP first +clear +n = 20; % <=60 +%% +directoryPath = "..\sorted_data"; +subdirectories = getSubdirectories(directoryPath); +%% +% Use the dir function to get information about files and directories +contents = dir(directoryPath); + +% Filter out the directories (excluding '.' and '..') +subdirectories_list = contents([contents.isdir] & ~ismember({contents.name}, {'.', '..'})); + +% Extract and display the names of the subdirectories +subdirectoryNames = {subdirectories_list.name}; +%% +figure() + +for i=1:length(subdirectories) + fileMeasurement = fullfile("..\sorted_data", subdirectories{i}, "\cornering.mat"); + parser = tydex.parsers.FSAETTC_SI_ISO_Mat(); + measurements = parser.run(fileMeasurement); + measurement = measurements(n); + + [SX,SA,FZ,IP,IA,VX,FX,FY,MZ,MY,MX,W,T] = unpack(measurement); + if i < length(subdirectories)/3 + plot(SA, FY, 'LineWidth', 1) + elseif i <= length(subdirectories)/3*2 + plot(SA, FY, '--','LineWidth', 1) + else + plot(SA, FY, '-.','LineWidth', 1) + end + hold on +end +legend(subdirectoryNames{:}) +title("Similarities, n=",n) +xlabel("Slip Angle") +ylabel("FY") \ No newline at end of file diff --git a/scripts/similarities.png b/scripts/similarities.png new file mode 100644 index 0000000..3745484 Binary files /dev/null and b/scripts/similarities.png differ