Master Thesis Code
by Simon Moser
Loading...
Searching...
No Matches
direction2num.m
Go to the documentation of this file.
1% =========================================================================== %
2%> @brief convert a direction to a number
3%>
4%> @param dir direction to convert (positive, negative)
5%>
6%> @retval num number
7%>
8%> @code
9%> num = direction2num("positive") % returns 1
10%> num = direction2num("negative") % returns -1
11%> @endcode
12%>
13%> %> @copyright see the file @ref LICENSE in the root directory of the repository
14% =========================================================================== %
15function num = direction2num(dir)
16
17arguments
18 dir (1,1) string
19end
20
21switch dir
22 case "positive"
23 num = 1;
24 case "negative"
25 num = -1;
26 otherwise
27 error("The direction %s does not correspond to a number", dir)
28end
29
30end
function direction2num(in dir)
convert a direction to a number