Beruflich Dokumente
Kultur Dokumente
Syntax
Save
Save workspace variables on disk Graphical Interface As an alternative to the save function, select Save Workspace As from the File menu in the MATLAB desktop, or use the Workspace browser.
Syntax
Open
Open files based on extension
Syntax
Description open('name') opens the object specified by the string name. The specific action taken upon opening depends on the type of object specified by name.
Opening a MAT-File
Fopen
Open a file or obtain information about open files
Syntax
Description
- fid = fopen(filename) opens the file filename for read access. (On PCs, fopen
opens files for binary read access.) - fid is a scalar MATLAB integer, called a file identifier. You use the fid as the first argument to other file input/output routines. If fopen cannot open the file, it returns -1. - fid = fopen(filename, mode) opens the file filename in the specified mode. The mode argument can be any of the following:
Fclose
Close one or more open files
Syntax
Description
Argument fid is a file identifier associated with an open file. (See fopen for a complete description of fid). If fid does not represent an open file, or if it is equal to 0, 1, or 2, then fclose throws an error. - status = fclose('all') closes all open files (except standard input, output, and error), returning 0 if successful and -1 if unsuccessful.
Fprintf
Write formatted data to file
Syntax
Description
This table lists the escape character sequences you use to specify nonprinting characters in a format specification.
Fread
Read binary data from file
Syntax
Description
- A = fread(fid) reads data in binary format from the file specified by fid into
matrix A. - Open the file using fopen before calling fread. The fid argument is the integer file identifier obtained from the fopen operation. - MATLAB reads the file from beginning to end, and then positions the file pointer at the end of the file.
Specifying Precision
Any of the strings in the following table, either the MATLAB version or their C or FORTRAN equivalent, can be used for precision. If precision is not specified, MATLAB uses the default, which is 'uchar'.
The following platform-dependent formats are also supported, but they are not guaranteed to be the same size on all platforms.
Examples:
Example 1 The file alphabet.txt contains the 26 letters of the English alphabet, all capitalized. Open the file for read access with fopen, and read the first five elements into output c. Because a precision has not been specified, MATLAB uses the default precision of uchar, and the output is numeric:
This time, specify that you want each element read as an unsigned 8-bit integer and output as a character. (Using a precision of 'char=>char' or '*char' will produce the same result):
When you leave out the optional count argument, MATLAB reads the file to the end, A through Z:
The fopen function positions the file pointer at the start of the file. So the first fread in this example reads the first five elements in the file, and then repositions the file pointer at the beginning of the next element. For this reason, the next fread picks up where the previous fread left off, at the character
Fwrite
Write binary data to a file
Syntax
Description
Examples:
Programs:
Reading and Writing wave files
Then ..
10
OR .
Then ..
SIMULINK
Now lets try something a little bit more complicated. First, build the following system (you can find the Clock module in the Sinks category. The Trigonometric Function and Sum modules reside in the Math category):
Now, lets see if the derivative is really a cosine. Build the following system (the Derivative module is located in the Continuous category):
We can see that this is indeed a cosine, but something is wrong at the beginning.
1. Low Pass Filter 2. High Pass Filter 3. Band Pass Filter 4. Band Stop Filter 5. Resonator Filter 6. Notch Filter Eng \ Hadeer Sobhy
15
Notch Filter
To get filter on simulink as follow: Signal Processing Blackest >>Filtering>>Filter Design>>Digital Filter Design