Save in App designer text area value not as .txt, .dat, or .csv file - Matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
I have tried to save an App designer text area value not as .txt, .dat, or .csv file (used for delimited text files) but rather as an .xyz format (mainly it is just a text file with different extension name).
I used this code line:
writecell(app.XYZfilecontentTextArea.Value, 'E:\SCH.xyz', 'QuoteStrings',false);
and I get this Error using writecell Unrecognized file extension '.xyz'. Use the 'FileType' parameter to specify the file type.
Any idea how can I save my data? It works fine if I wish to save it as txt.
댓글 수: 0
답변 (2개)
Voss
2023년 10월 16일
writecell(app.XYZfilecontentTextArea.Value, 'E:\SCH.xyz', 'QuoteStrings',false, 'FileType','text');
댓글 수: 0
dpb
2023년 10월 16일
편집: dpb
2023년 10월 17일
writecell(app.XYZfilecontentTextArea.Value, 'E:\SCH.xyz', 'QuoteStrings',false,'FileType','text');
Although from just a practical standpoint, if it is a text file, then .txt would seem a much more logical extension to pick unless there really is some other meaning that is assigned to xyz that has bearing on the file content/application.
It doesn't really matter what a file is named other than one of some convenience with some of the OS conventions like file association with applications and the need for special handling like the above when go against convention in MATLAB, other than there are some applications like Excel that simply won't allow such shenanigans. I've not checked recently whether it would let you import such a file or not; I know it won't open a .xls_ file of any variety unless the extension matches what is expected for the format; that's how it chooses the engine with which to try to open it.
ADDENDUM
" I've not checked recently whether it would let you import such a file or not;..."
I just did; it will let you open a csv file not named as such, but you then have to go thru the import wizard by hand to set the delimiter to match in order for Excel to import the fields into cells--by default it picks tab, not comma and you get every record in a single cell. All in all, it just seems like abadidea™ to not use conventional naming unless there's a very specific reason otherwise; looks a though will likely just cause trouble down the line.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!