Lecture-27(matlab) - Programming Elements of MATLAB Data...

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

View Full Document Right Arrow Icon
Programming Elements of MATLAB
Background image of page 1

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

View Full DocumentRight Arrow Icon
Data Declaration Variables are declared dynamically by assigning a value to the variable e.g. >> A = ‘program’ – causes a string variable A to be defined to which is assigned the character string ‘program’ >> B=[ ] causes a variable B to be declared that is a double array of size 0 x 0 >> A=[1,2,3;3,4,5] causes a double array A to be declared of size 2 x 3 You can check the size, type and number of bytes required to store the array (or variable) by typing whos at the command prompt Another way to declare a variable in a program is by using the input statement – displays a prompt in the command window and waits for the user to type a response >> C = input( ‘Type a number:’) Type a number: Prompt is displayed in the window
Background image of page 2
Data Declaration (Cont’d) Characters declared by using a single quote as a delimiter >> C = ‘W’ Characters are stored internally in MATLAB as16-bit integers (i.e. from 0 to 255) – for example W is stored using the code 87.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/27/2008 for the course PGE 310f taught by Professor Srinivasan during the Spring '08 term at University of Texas at Austin.

Page1 / 11

Lecture-27(matlab) - Programming Elements of MATLAB Data...

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

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