Apply conditions in if statement.

27 次查看(过去 30 天)
Silpa K
Silpa K 2019-10-13
A = [];
for ii = 1:length(subSequence)
if any(ismember(subSequence{ii},out)) && mod(k-midpoint)<=G+l/2
A{end+1} = subSequence{ii};
end
end
Iam getting errors when Iam using the second condition 'mod(k-midpoint)<=G+l/2'.
The error is like:
Error using mod
Not enough input arguments.
Error in Facetra (line 38)
if any(ismember(subSequence{ii},out)) && mod(k-midpoint)<=G+l/2
How can I avoid this errors.
  4 个评论
Walter Roberson
Walter Roberson 2019-10-13
You appear to be wanting to use a different function named mod than the Mathworks function, which is the mathematical Modulo (remainder) operator. The mathematical Modulo operator always has two parameters: the value whose remainder is to be found, and the base with respect to which the remainder is to be found. For example, mod(7,3) asks to find the remainder with respect to division by 3 for the number 7.
You will need to locate source code or implementing library for whatever the function named mod does, and add that to your MATLAB path earlier than the MATLAB mathematics libraries.
If at all possible you should rename that third-party mod function, as otherwise it is very likely you will run into conflicts with the mathematical Modulo operator.
Shivam Prasad
Shivam Prasad 2019-10-16
Hi Silpa,
Can you let me know what are you trying to do in these lines of code? Maybe you require a different function to implement the operation.
The mod function defined as mod(a,b) implements the mathematical operation a%b, which is the remainder when a is divided by b.
More on mod function :-

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by