Save in App designer text area value not as .txt, .dat, or .csv file - Matlab
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Voss
le 16 Oct 2023
writecell(app.XYZfilecontentTextArea.Value, 'E:\SCH.xyz', 'QuoteStrings',false, 'FileType','text');
0 commentaires
dpb
le 16 Oct 2023
Modifié(e) : dpb
le 17 Oct 2023
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 commentaires
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!