Out of curiosity, if I type these lines in MATLAB:
a = logical([12 0 1.2]);
b = boolean([12 0 1.2]);
The output variables a
and b
are the same (same value and type). Hence, is there any difference between boolean
and logical
?
A quick look at the boolean function can give you a good answer to your question:
If you type : edit boolean
in the matlab console you get:
function y = boolean(x)
%BOOLEAN Creates a boolean vector.
% This function is typically used in Simulink parameter dialogs, such as
% the Constant block dialog. This function generates a logical vector,
% which is treated as a boolean value in Simulink. Now that logical is a
% MATLAB type, this function is essentially just an alias.
%
% Y = BOOLEAN(X) Converts the vector X into a boolean vector.
%
% Example:
% boolean([0 1 1]) returns [0 1 1]
%
% See also LOGICAL.
% Copyright 1990-2012 The MathWorks, Inc.
narginchk(1,1);
if ~isreal(x)
DAStudio.error('Simulink:utility:BooleanCannotBeComplex');
end
y = logical(x);
If you look at the last line of this function, you can see that the boolean function call the logical function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With