open and edit a lvm file (similar to txt file)

14 次查看(过去 30 天)
Hi,
I have a lvm file (labview measurement file) which I open with Notepad or other text editors. So, I hope I can open and edit it as a text file in Matlab as well.
I want to delete the first 20 lines of the file. Could you please advise?
Thanks.
A sample lvm file:

回答(1 个)

Image Analyst
Image Analyst 2012-7-29
Basically you'll use fopen() (twice once for the input file and once for the output file), then fgets() from the input file 20 times, then loop where you fgets() from the input file, fprintf() to the output file, then fclose() both input and output file. If you want, delete the input file and use copyfile() or movefile() to copy the new file with the 230 missing lines to have the same name as the original input file.
It's pretty obvious so I'm sure you already tried it, but what was the error or unexpected results you encountered?

类别

Help CenterFile Exchange 中查找有关 Low-Level File I/O 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by