AME 150L Lecture 22: Strings (cont.)
Document Summary
Load x. dat will load if in . dat format and is only numbers textscan is used for loading into matlab for data with different format: example file: Fid(usually a number) = fopen( name","rt") (r = read-only, t = text/ascii file) A = textscan(fid, "%s %s %s %f) Have to write the type of data that will be encountered in each column (%s. = string, %f = floating number, %d = integer) A is a cell array: a{ii,jj} = numerical and character array (the elements are: extracting data from a cell array: char(a{1,1}) --> james / sally arrays) Upper(str); lower(str) converts the string to upper/lower case. Num2str(value,arg2) where arg2 can be the type of value being entered (formatting statement) Eval(str) executes operations in a string producing numerical value. Str2double(str) will convert the string to a number, but not operations. "6. 28" will be converted but not "2*pi" Str = dec2bin(bum) & num = bin2dec(str) converts to binary/decimal (base conversion functions)