Illustration of spreadsheet files, MATLAB in Mathematics

Illustration of Spreadsheet Files:

This reads the numbers in a double vector variable nums and the text in a cell array txt (the xlsread function forever returns the numbers first and later text). The cell array is 4 × 3. It consist three columns as the file had three columns, but as the middle column had numbers (that were extracted and stored in the nums vector), at middle column in the cell array txt consists of the empty strings.

>> txt{1,2}

ans =

    ''

>> txt{1,3}

ans =

Cindy

 

A loop can then be used to echo-print the values from the spreadsheet in the original format:

>> for i = 1:length(nums)

     fprintf('%c %d %s\n', txt{i,1}, ...

      nums(i), txt{i,3})

   end

a  123  Cindy

b  333  Suzanne

c  432  David

d  987  Burt

Posted Date: 10/20/2012 6:39:57 AM | Location : United States







Related Discussions:- Illustration of spreadsheet files, Assignment Help, Ask Question on Illustration of spreadsheet files, Get Answer, Expert's Help, Illustration of spreadsheet files Discussions

Write discussion on Illustration of spreadsheet files
Your posts are moderated
Related Questions
Function isreal - complex numbers: The function isreal returns 1 for logical true when there is no imaginary part of the argument, or 0 for false when the argument does have a

Example of Minimum and Maximum Value For matrices, the functions min and max operate column wise by the default: >> mat = randint(2,4,[1 20]) mat =    9   10   1

Error-checking for integers: illustrations of running this script as shown below: >> readoneint Enter an integer: 9.5 Invalid! Enter an integer: 3.6 Invalid

Illustration of Writing to files: Here is the other illustration in which a matrix is written to a file. At First, an arbitrary 2 × 4 matrix is generated, and then it is writt

Changing Dimensions: In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, resh

Structure Consisting of the Fields A MATLAB can also solve the sets of equations. In this illustration, the solutions for x, y, & z are returned as a structure consisting of th

Illustration of Writing variables to a file: For illustration, in the below session in the Command Window, 3 variables are generated; these are then exhibited using who. Then,

Writing to Files: There are many lower level functions which can write to files. We will focus on the fprintf function that can be used to write a file and also to append to a

Illustration of Empty vectors: The Empty vectors can also be used to delete elements from the arrays. For illustration, to remove the third element from array, an empty vector

Creating string Variables: The string consists of a few numbers of characters (including, possibly, none). These are the illustrations of the strings: '' 'x' 'ca