Error with find Function in MATLAB: “Incorrect number or types of inputs or outputs”
Hello,
I am encountering an error in MATLAB when using the find function in my code. The error message is:
Error using find Incorrect number or types of inputs or outputs for function ‘find’.
The error occurs in the following function:
function SNR_matrix = Compute_SNR(K, N, M, A, z,…);
SNR_matrix = optimexpr(K, N, M);
for v = 1:M
for s = 1:K
for n = 1:N
Arg1 = find(A(s, :, v), 1); % This line causes the error
% [Additional code here]
end
end
end
end
and ”A” is a Binary decision variable
A = optimvar(‘A’, K, N, M, ‘Type’, ‘integer’, ‘LowerBound’, 0, ‘UpperBound’, 1);
How can I resolve this error? Are there specific issues with how find is used with multi-dimensional arrays? What adjustments should I make to ensure that the find function works correctly in this context?
Any Help will be appreciated.
Thanks in advance!Hello,
I am encountering an error in MATLAB when using the find function in my code. The error message is:
Error using find Incorrect number or types of inputs or outputs for function ‘find’.
The error occurs in the following function:
function SNR_matrix = Compute_SNR(K, N, M, A, z,…);
SNR_matrix = optimexpr(K, N, M);
for v = 1:M
for s = 1:K
for n = 1:N
Arg1 = find(A(s, :, v), 1); % This line causes the error
% [Additional code here]
end
end
end
end
and ”A” is a Binary decision variable
A = optimvar(‘A’, K, N, M, ‘Type’, ‘integer’, ‘LowerBound’, 0, ‘UpperBound’, 1);
How can I resolve this error? Are there specific issues with how find is used with multi-dimensional arrays? What adjustments should I make to ensure that the find function works correctly in this context?
Any Help will be appreciated.
Thanks in advance! Hello,
I am encountering an error in MATLAB when using the find function in my code. The error message is:
Error using find Incorrect number or types of inputs or outputs for function ‘find’.
The error occurs in the following function:
function SNR_matrix = Compute_SNR(K, N, M, A, z,…);
SNR_matrix = optimexpr(K, N, M);
for v = 1:M
for s = 1:K
for n = 1:N
Arg1 = find(A(s, :, v), 1); % This line causes the error
% [Additional code here]
end
end
end
end
and ”A” is a Binary decision variable
A = optimvar(‘A’, K, N, M, ‘Type’, ‘integer’, ‘LowerBound’, 0, ‘UpperBound’, 1);
How can I resolve this error? Are there specific issues with how find is used with multi-dimensional arrays? What adjustments should I make to ensure that the find function works correctly in this context?
Any Help will be appreciated.
Thanks in advance! error, matlab code, find, function, optimization MATLAB Answers — New Questions