EXPORT OUTPUT TO READABLE .PRJ FILE

8 次查看(过去 30 天)
Aiman Syahmi
Aiman Syahmi 2022-8-23
回答: Abhaya 2024-10-4
Hi, good day to all.
im trying to write a script that is able to update the projections in mapinfo. The idea is that the user simply needs to update the parameters of the projection in an excel and then MATLAB is used to update the updated parameters inside the mapinfo (.PRJ) file.
Within MATLAB everything works fine. Its a 2273 x 1 cell. Attached below is how i want the output to look like.
However, when i export it looks like this:
The problem that i face are:
1) Too many semicolons "" written at beginning and ending of each line
2) I still havent found any method to export to .PRJ format. Currently only exporting in .TXT.
The line that i used to export the data is: writecell(ans, 'MyFile.txt')
Kindly assist in my problem. Thanks.

回答(1 个)

Abhaya
Abhaya 2024-10-4
Hi Aiman,
The extra double quotes in your text are caused by the ‘QuoteStrings’ property of the writecell’ function. By default, this option is set to minimal, which means it encloses delimiters, line endings, or double-quote characters in double quotes.
To remove these extra quotes, set the QuoteStrings property of the writecell’ function to false.
writecell(ans, 'MyFile.txt','QuoteStrings',false)
For further details on the writecell function, you can check out the MATLAB documentation given below.
The ‘.prj files typically follow the Well-Known Text (WKT) format. In MATLAB, the wktstring function can be used to generate WKT string representation of the specified projected or geographic coordinate reference system. To generate a ‘.prj’ file from a coordinate reference system, please refer to the MATLAB documentation linked below.
Hope this solves your query.

Community Treasure Hunt

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

Start Hunting!

Translated by