Apply conditions in if statement.

16 visualizaciones (últimos 30 días)
Silpa K
Silpa K el 13 de Oct. de 2019
Comentada: Shivam Prasad el 16 de Oct. de 2019
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 comentarios
Walter Roberson
Walter Roberson el 13 de Oct. de 2019
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 el 16 de Oct. de 2019
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 :-

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by