Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Files in matlab GUI

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the matlab GUI file example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Low-level file I/O1. File reading

Fopen: file openin

Fclose: file closin

Fread: reading binary data

Fwrite: binary file writ

Fgetl: read line by line

Fgets: read line by line

Fscanf: format read:

Fprintf: formatting write

Clear all

[fid,message] = fopen ('file2.txt','w+')

If fid==-1

Disp (message)

Else

Fwrite (fid,'good moring','uint8')

End

Fclose (fid)

[fid,message] = fopen ('file2.txt','r')

If fid==-1

Disp (message)

Else

A1=fread (fid)

A1'

Disp (char (A1)')

End

Fclose (fid)

Read matrix data

Read the text file line by line

With fgetl () and fgets (), you can read data line by line from a formatted file file and save it as a string. The basic functions of the two functions are the same, except that the function fgets () copies a new line of characters into the string, while the function fgetl () is not.

Clear all

[fid,message] = fopen ('file3.txt','w+')

If fid==-1

Disp (message)

Else

Magic (4)

Fwrite (fid,magic (4), 'int32')

End

Fclose (fid)

[fid,message] = fopen ('file3.txt','r')

If fid==-1

Disp (message)

Else

A1=fread (fid, [3 3], 'int32')

A1

End

Fclose (fid)

two。 Internal control of documents

When you open a file, a file identity is generated that indicates the current location in the file. It is done by controlling the file identity to read and write the file.

Function

Description

Feof

Test whether to reach the end of the file

Fseek

Move the file identity to a specific location

Frewind

Move the file identity to the file header

Ftell

Get the location of the document identification

Thank you for reading this article carefully. I hope the article "sample Analysis of documents in matlab GUI" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report