%I am looking to replace NaN values in a given matrix using a formula.
%Suppose that row 1 of matrix A are totals (See column 3).
%Row 2-4 are subsectors that when summed equal the total.
A = [1100 1200 1125 1635 1850; 45 22 NaN 35 51; NaN NaN 510 600 782; 732 522 534 1000 NaN]
%Another matrix C corresponds to a particular row's average percentage of the total.
C =
0.0281 0.4143 0.5633
%I want to replace each NaN value by multiplying the Total by the coresponding average for that row.
%ie. The NaN value that occurs at A(3,1) would be replaced by .4143*1100=414.3
%any help would be appreciated.
Best Answer