Lecture+8-Matlab+output+_+structure

Lecture+8-Matlab+output+_+structure - Load Files s Create...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Create an ASCII file temperature.dat read “Time” and “Temperature” from temp.dat >> load temperature.dat >> temp=temperature(:,2) 0.0 75.0 0.5 73.2 1.0 72.6 1.5 74.8 2.0 79.3 2.5 83.2 Load Files Note: temperature is a 6 × 2 matrix
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Formatted Output fprintf (‘ format’ , var, ….) % [flags] [width] [.precision] type Examples of “type” fields %d display in integer format %e display in lowercase exponential notation %E display in uppercase exponential notation %f display in fixed point or decimal notation %g display using %e or %f , depending on which is shorter % % display “ %
Background image of page 2
Numeric Display Format Command Display Example format short default 3.1416 format long 15 decimals 3.141592653589793 format bank 2 decimals 3.14 format , ,blank MATLAB + + - + x = [5 -2 3 0 1 -2]; format + x = [+ - + + - ] (+/ - sign only)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
fprintf( ) of Scalar temp = 98.57; fprintf(‘The temperature is %8.1f degrees F.\ n ’, temp ); The temperature is 98.6 degrees F. fprintf(‘The temperature is %8.3e degrees F.\n’, temp); The temperature is 9.570e+001 degrees F. fprintf(‘The temperature is %08.2f degrees F.\n’, temp); The temperature is 00098.57 degrees F.
Background image of page 4
fprintf( ) of Matrices Score = [1 2 3 4; 95 88 102 93; 89 84 95 85]; Game 1 score: UF: 95 FSU: 89 Game 2 score: UF: 88 FSU: 84 Game 3 score: UF: 102 FSU: 95 Game 4 score: UF: 93 FSU: 85 fprintf(‘Game % 1.0f score: UF: % 3.0f FSU: % 3.0f \n’,Score) fprintf control codes \n Start new line \t Tab
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Interactive input Function The input function allows you to prompt the user for values directly from the command window
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 21

Lecture+8-Matlab+output+_+structure - Load Files s Create...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online