Date post: | 19-Dec-2015 |
Category: |
Documents |
View: | 213 times |
Download: | 0 times |
General Computer General Computer Science Science
for Engineersfor EngineersCISC 106CISC 106
Lecture 22Lecture 22
Dr. John CavazosComputer and Information Sciences
04/13/2009
Lecture OverviewLecture OverviewSymbolic Debugger (137-140)Date Types
Memory size/efficiency/accuracy
Symbolic DebuggerSymbolic DebuggerOpen m-file to debug in Matlab
editorCan set breakpoints
Where you want execution to suspend
Execute in command window as normal
, 2009 from 1:00 PM to 1:30 PM
Symbolic DebuggerSymbolic DebuggerExecution suspends in editor at
breakpointCan view variables in command
windowCan step through the codeCan continue to next
breakpoint17, 2009 from 1:00 PM to 1:30 PM
Classes of Data TypesClasses of Data Types
Single-Precision floating Single-Precision floating pointpointStores number in 32 bitsBit 31 is sign (0 = positive, 1 =
negative)Bits 0 through 30 for number
(exponent and fraction), 2009 from 1:00 PM to 1:30 PM
Double-Precision (default)Double-Precision (default)Stores number in 64 bits
Bit 63 is sign (0 = positive, 1 = negative)
Bits 0 through 62 for number (exponent and fraction), 2009
from 1:00 PM to 1:30 PM
Integers (Signed Values)Integers (Signed Values)int8 (8 bits) can represent -128 to
127int16, int32, int64
x = int8(200) x ←127
x=int8(-500)x ← -128;
Integers (Unsigned Integers (Unsigned Values)Values)uint8 (8 bits) can represent 0 to
255uint16, uint32, uint64
x = uint8(400) x ←255
x=uint8(-500)x ← 0;
iintmin and intmaxntmin and intmax
intmin(‘uint8’) 0intmax(‘int8’) 127
Integer arraysInteger arrays
array = zeros(100,100, ‘int8’);
Creates a 100-by-100 int8 array initialized to zero.
EfficiencyEfficiency
• If array will only require certain values• Use correct datatype!
• For example:• Images typically only have 0-
255 values• Need only uint8
Efficiency (cont’d)Efficiency (cont’d)
• double requires 8 bytes• uint8 requires 1 byte• Double requires 8 times more
memory to store images!