The data consists of a subset of the entries of a low-rank matrix. Your goal is to fill in the entries marked NaN with numerical values. How to use MATLAB to do this? Thanks!
MATLAB Code:
close all
clear
clc
A = ones(10);
A(2:5,3:5) = nan(4,3); % Just populating
A(6:7,4:7) = nan(2,4); % A with
A(9:10,10) = nan(2,1); % some NaNs.
disp('A = '), disp(A)
A = fillmissing(A,'constant',0); % Fill NaNs with a constant value
of 0.
disp('After filling NaN entries with zeros, A = '), disp(A)
Output:
Get Answers For Free
Most questions answered within 1 hours.