Insert blank cells in a matrix

53 views (last 30 days)
How can I replace all the NaN values of a matrix with a blank space?

Accepted Answer

Walter Roberson
Walter Roberson on 30 Nov 2021
You cannot do that. Numeric matrices cannot have spaces in them.
You can convert the matrix into a cell array and put spaces into the cell array... but it is not clear why you would do that.
myCell = num2cell(MyMatrix);
myCell(isnan(MyMatrix)) = {' '}; %nan -> space
Now what?
Walter Roberson
Walter Roberson on 2 Dec 2021
Use the version with compose and fmt

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!