A.ben
A.ben

Reputation: 13

how to convert this expression to a MATLAB code

I am new to programming and i start with Matlab. How to convert this expression to a MATLAB code :

a = if !IsNaN(x) then b else Double.NaN;

Upvotes: 0

Views: 59

Answers (1)

Vahni
Vahni

Reputation: 272

The "not" functionality of "!" is implemented by "~" in MATLAB.

So, your code would look something like

if ~isnan(x)
   a = b
else 
   a = NaN;
end

Upvotes: 2

Related Questions