Hi, I'm searching for a way to edit g code files in matlab, what type of script can I use?

4 Kommentare

dpb
dpb am 15 Aug. 2022
G code files are just text so you can manually open them in the editor just like m files. Of course, there's no context-sensitve help, auto-complete, etc., etc., ...
What do you mean to try to do with MATLAB and the files -- make automatic code changes of parameters like say a spindle speed or somesuch?
If so, the only tools MATLAB has to offer for the purpose are the basic string handling functions -- one might find the new(ish) pattern matching function that is similar to writing regular expressions (regexp) useful unless you're already familiar with its syntax.
It's been nearly 40 years since I've done anything in the area so I've no idea what toolsets are out there now -- back then one was mostly tied into the vendor's proprietary toolset; it's undolubtedly possilbe now to find generic tools and I'm sure there must be handy generic editors/programming environments. Whether there might be some developed for/in MATLAB ...
Well, there's at least one FEX submission <fileexchange/67767-g-code-reader>
Federico Paolucci
Federico Paolucci am 16 Aug. 2022
okay, thank you!
Walter Roberson
Walter Roberson am 16 Aug. 2022
To summarize: unless you have fixed length records and never need to insert or delete records, then you should probably be reading from one file, modifying the in-memory copy, and writing the modified version to a new file.
Depending on what changes have to be made, sometimes there are efficient ways to make some kinds of changes. For example it might be efficient to change all occurances of 'G2' to 'G3,0' in-memory.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Produkte

Version

R2022a

Gefragt:

am 15 Aug. 2022

Kommentiert:

am 16 Aug. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by