How to do some calculations on nonzero nonNAN elements of an array

1 view (last 30 days)
I have an array of about 400*20 size and some of its members are NAN or zero. There is a second array of the same size which I need to divide the first array by corrsponding member of the second array: FirstArrayName./SecondArrayName
how can I exclude non zero non NAN elements from this calculation?

Sign in to comment.

Answers (1)

Tiago Dias
Tiago Dias on 2 Dec 2019
Hello, is this what u want to do?
A = [1 NaN 2 NaN;3 1 4 5]
result = A(1,:) ./ A(2,:)
result =
0.3333 NaN 0.5000 NaN
Tiago Dias
Tiago Dias on 3 Dec 2019
Could you provide a sample of your data? and the result you expect?

Sign in to comment.


Find more on Tables in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by