How do I save a matrix of integers to a text file in Matlab?

前端 未结 3 1020
轮回少年
轮回少年 2020-12-28 08:51

I have a 2D matrix myMatrix of integers which I want to save its content to a text file. I did the following:

save myFile.txt myMatrix -ASCII
         


        
3条回答
  •  难免孤独
    2020-12-28 09:48

    To write myMatrix to myFile.txt:

    dlmwrite('myFile.txt', myMatrix);
    

    To read the file into a new matrix:

    newMatrix = dlmread('myFile.txt');
    

提交回复
热议问题