How to insert NaN at the end of matrix (.mat)

I have a matrix (.mat) with two columns and I want to insert a line of NaN at the end of matrix...

 Accepted Answer

Hello,
Would it be sufficient to:
load('your_file.mat')
Matrix_Name = [Matrix_Name; NaN NaN];
% Get rid of extra workspace variables so they're not also saved:
clearvars -except Matrix_Name
save('your_file.mat')
Hope this helps!

4 Comments

Hi John, thank you... but it didn't work... the following message appeared.. "The following error occurred converting from double to struct: Error using struct Conversion to struct from double is not possible"..
I forgot ... the data is <89x2 double>
Now it works :).. thx
Awesome! Glad you figured it out!

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!