How to use copyfile function correctly?
4 次查看(过去 30 天)
显示 更早的评论
I have a text file which was created in the "Current Folder" window. Now, I want to re-save this file in another direction (or copy the file as I did). This is my code:
[FileName,PathDir] = uiputfile('log_MCES.txt','Save Calculation Notes');
if isequal(FileName,0) || isequal(PathDir,0)
else
copyfile(FileName, PathDir)
end
The original file it contains the following:
Note 1: [Graphical Representation] A cost node is invisible for an energy node.
=====================================
Note 2: An Optimum Solution has been Achieved.
=====================================
But the copied one is:
Note 1: [Graphical Representation] A cost node is invisible for an energy node.=====================================Note 2: An Optimum Solution has been Achieved.=====================================
As shown, the order of the texts has been changed and I don't know why?
0 个评论
采纳的回答
Steven Lord
2015-8-27
The order of the text hasn't changed. It's being displayed with fewer newlines, but I suspect that's because you've opened the file in Microsoft Notepad. What does the file look like if you open it in the MATLAB Editor?
5 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!