forked from Hyp-ed/trajectory-simulation-19-20
-
Notifications
You must be signed in to change notification settings - Fork 0
/
importLimParameters.m
executable file
·34 lines (31 loc) · 1.72 KB
/
importLimParameters.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function [ Parameter ] = importLimParameters()
% importLimParameters Imports the Lim parameters
% Inputs:
% Output:
% [ Parameter ] Parameter structure containing imported variables
% @author ?, HypED
% Modified: Rafael Anderka 02/11/2018
% Modified: Simona Prokopovic 07/11/2018
% Modified: Lorenzo Principe 12/11/2019
% Set filepath to the excel workbook
params_filepath = './Parameters/Lim_parameters.xlsx';
% Import spreadsheets using the importSpreadsheet function
% Input arguments of importSpreadsheet:
% 1 Filepath to .xlsx,
% 2 spreadsheet name,
% 3 range of ROWS of the variable names to be imported
% 4 COLUMN of the variable names to be imported
% 5 range of ROWS of the variable values to be imported
% 6 COLUMN of the variable values to be imported
Constants = importSpreadsheet(params_filepath, 'Constants', 3:8, 3, 3:8, 4);
Variables = importSpreadsheet(params_filepath, 'Variables', 3:4, 3, 3:4, 4);
Tube = importSpreadsheet(params_filepath, 'Tube', 3:3, 3, 3:3, 4);
Pod = importSpreadsheet(params_filepath, 'Pod', 3:12, 3, 3:12, 4);
% Put all variables in a single cell array and create a parameter structure
FullArray = [Constants;Variables;Tube;Pod]; % Create a single array with all variables
for index = 1 : length(FullArray)
if (~isnan(FullArray{index,2})) % Check if variable value (column 2) is valid
Parameter.(FullArray{index,1}) = FullArray{index,2}; % Assign variable value (column 2) to corresponding variable name (column 1)
end
end
end