346 Introduction to C++ Programming and Graphics
break Terminate the execution
else Use with theifstatement
elseif Use with theifstatement
end Terminate aforloop, awhileloop, or anifblock
error Display a message and abort
for Loop over commands a specific number of times
if Conditionally execute commands
pause Wait for user’s response
return Return to theMatlabenvironment,
invoking program or function
while Repeat statements an indefinite number of times
until a specified condition is met
Table F.1.2Matlablogical control flow commands and construct components.
disp Display numerical values or text
Use as: disp disp() disp(‘text’)
fclose Close a file
fopen Open a file
fread Read binary data from a file
fwrite Write binary data to a file
fgetl Read a line from a file, discard newline character
fgets Read a line from a file, keep newline character
fprintf Write formatted data to a file using C language conventions
fscanf Read formatted data from a file
feof Test for end-of-file (EOF)
ferror Inquire the I/O error status of a file
frewind Rewind a file
fseek Set file position indicator
ftell Get file position indicator
sprintf Write formatted data to string
sscanf Read formatted string from file
csvread Read from a file values separated by commas
csvwrite Write into file values separated by commas
uigetfile Retrieve the name of a file to open through dialog box
uiputfile Retrieve the name of a file to write through dialog box
Table F.1.3MatlabInput/Output (I/O) commands.
F.2 Precision................................
Matlabstores all numbers in the long format of the floating-point represen-
tation. This means that real numbers have a finite precision of roughly sixteen