writematrix does NOT overwrite existing file

10 ビュー (過去 30 日間)
Saeid
Saeid 2025 年 6 月 23 日
コメント済み: Abhishek 2025 年 7 月 2 日
In the new 2025a version, When trying to overwrite an existing file using writematrix, the old data does not change, but I also do not see an error message telling me that overwrite is (for whatever reason) is not possible. In other words: I run the script, it ends, and the new data is not in the file. I did not have this problem with any of the previous versions.
  13 件のコメント
Walter Roberson
Walter Roberson 2025 年 6 月 23 日
You are right, I forgot about the file extension problem. I see from the documentation that the default is to add the extension ".txt"
Abhishek
Abhishek 2025 年 7 月 2 日
@Saeid Hi, I beleive this problem has something do with the local environment of your machine. Can you try running this code in your machine, and try updating the values of matrix, and at each update run it. See if the contents of the file change or not:
data = [1 2 3; 4 5 6; 7 8 9];
filename = 'mydata.txt';
writematrix(data, filename);
Or maybe, you can post the minimal code so that I can reproduce it on my end.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

製品


リリース

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by