PROBLEM:
I want to use logical functions to perform calculations between
matrices and don't know how to generate an empty value NaN.
EXAMPLE:
I use the two matrices below and if the conditions are not satisfied,
the output should be empty:
clear all;
close all;
m=rand(10,5);
n=rand(10,5);
T = zeros(size(m)); % Make another array to fill up…
for i = 1:numel(m)
if m(i)>.5 && n(i)>.5 T(i) = m(i+1)+n(i+1); else T(i) = 'NaN'; end
end
However, I obtain the following error:
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.
I hope someone know the correction of this mistake
Thank you in advance
Emerson
Best Answer