instead of saving a mat file i want ro save a .txt, i want to use fopen, fclose, and fprintf

2 次查看(过去 30 天)
Instead of saving the lists of processes to Core1.mat and Core2.mat, write the lists of processes to the files Core1.txt and Core2.txt, respectively. You may use the functions fopen(), fclose(), and fprintf().
  1 个评论
Geoff Hayes
Geoff Hayes 2020-4-5
Alex - this seems like homework, so what have you tried so far? Please discuss your attempt, include code, etc. and indicate where you are having a problem. If you are observing error messages, please copy and paste the full error message (along with corresponding code) to this question.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2020-4-5
fid = fopen('OutputFile.txt', 'w');
fprintf(fid, '%d\n', 1:10);
fclose(fid)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by