我在一个简单的乘法过程中偶然发现了一个错误,这让我很惊讶。这里发生的事情,我一直认为*
只是矩阵乘法。
x = 2;
y = zeros(1,4);
y(1) = 1 *x;
y(2) = x* 1;
y(3) = (x *1);
y(4) = x *1;
y
x *1
将给出以下输出:
y =
2 2 2 1
Error: "x" was previously used as a variable,
conflicting with its use here as the name of a function or command.
See MATLAB Programming, "How MATLAB Recognizes Function Calls That Use Command Syntax" for details.
有谁明白这里发生了什么?当然,我证实这x
不是一个功能。