-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathiif.m
More file actions
36 lines (35 loc) · 663 Bytes
/
iif.m
File metadata and controls
36 lines (35 loc) · 663 Bytes
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
35
36
function out = iif(trueFalse, outTrue, outFalse)
% emulates javas ? operator
%
%% DESCRIPTION
% simplifies following statement:
% if foo == bar
% var = something;
% else
% var = something else;
% end
% to:
% var = iif(foo == bar, something, something else);
%
%% VERSIONING
% Author: Andreas Justin
% Creation date: 2018-11-19
% Matlab: 9.5, (R2018b)
% Required Products: -
%
%% REVISONS
% V0.1 | 2018-11-19 | Andreas Justin | first implementation
%
% See also
%
%% EXAMPLES
%{
iif(true, "TRUE", "FALSE")
ans =
"TRUE"
%}
if trueFalse
out = outTrue;
else
out = outFalse;
end