MATLAB: Replacing elements in a table

find anf replace

I have Table A that constitutes of arrays, Some of the columns were computed using algebraic equations. This yielded certain numbers to be Inf and -Inf
How can I remove these from A and replace them with NaNs?

Best Answer

A=table2array(A);
A(isinf(A)|-isinf(A))=nan;
A=array2table(A)