Illustration of writing variables to a file, MATLAB in Mathematics

Assignment Help:

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, the variables are saved to file named 'sess1.mat'. The who function is then used to show the variables stored in that file.

>> mymat = rand(3,5)

mymat =

   0.9501   0.4860   0.4565   0.4447   0.9218

   0.2311   0.8913   0.0185   0.6154   0.7382

   0.6068   0.7621   0.8214   0.7919   0.1763

>> x = 1:6;

>> y = x.^2;

>> who

Your variables are:

mymat x y

>> save sess1

>> who -file sess1

Your variables are:

mymat x y

 

To save only one variable to a file, the format is as shown below:

save filename variablename

 

For illustration, only the matrix variable mymat is saved in a file known as sess2

>> save sess2 mymat

>> who -file sess2

Your variables are:

mymat

 


Related Discussions:- Illustration of writing variables to a file

Example of symbolic expression, Example of Symbolic Expression When the...

Example of Symbolic Expression When there is more than one variable, the MATLAB selects which to solve for. In the illustration below, the equation ax 2 + bx = 0 is solved. Th

Rational function, Give the formula for a rational function that has a hole...

Give the formula for a rational function that has a hole at x=7 & vertical asmptote at x=-3/2

Strcat function - concatenation, Strcat function - Concatenation : The ...

Strcat function - Concatenation : The strcat function, though, will eliminate the trailing blanks from strings before concatenating. Note that in these illustrations, the trail

Print an imaginary number, Print an imaginary number: To print an imag...

Print an imaginary number: To print an imaginary number, the function disp will show both parts automatically: >> disp(z1)    4.0000 + 2.0000i The function fprint

Illustration of nested function, Illustration of nested function: The ...

Illustration of nested function: The output arguments are distinct from variables. The scope of an output argument is merely the nested function; and it cannot be used in the

Illustration of writing to files, Illustration of Writing to files: He...

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

Types of user-defined functions, Types of User-defined Functions: We k...

Types of User-defined Functions: We know how to write a user-defined function, stored in an M-file, which computes and returns one value. This is merely one type of the functi

Optimal foraging theory, This project requires you to use the ideas of Chap...

This project requires you to use the ideas of Chapter 25 regarding maximization of a function. Here we assume that evolution has acted to generate highly efficient foragers. By hig

Example of recursive functions, Example of Recursive functions: This d...

Example of Recursive functions: This definition is recursive as a factorial is defined in terms of the other factorial. There are two parts to any recursive definition: the co

Functions to create special matrices, Functions to create special matrices:...

Functions to create special matrices: The MATLAB also has various functions which create special matrices. For illustration, the zeros function generates a matrix of all zeros

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd