EXPORT OUTPUT TO READABLE .PRJ FILE

9 views (last 30 days)
Aiman Syahmi
Aiman Syahmi on 23 Aug 2022
Answered: Abhaya on 4 Oct 2024
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.

Answers (1)

Abhaya
Abhaya on 4 Oct 2024
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!