Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

From the Data Files folder on ANGEL, download the file lab4data.csv and save it

ID: 670133 • Letter: F

Question

From the Data Files folder on ANGEL, download the file lab4data.csv and save it to your desktop. Use the load command to read the data from the file on your desktop into the Workspace. After you load in the data, you'll see that the variable lab4data has the following format: The first column of the data contains time steps. The second column of the data contains x-value corresponding to the times in column 1. The third column of the data contains y-values corresponding to the times in column 1.

Explanation / Answer

1.Create two values, save them to an ASCII file,
and then view the contents of the file.

x = rand(1,10);
y = ones(10);
save('username_lab4_matrixA.dat','x','y','-ascii')
type('username_lab4_matrixA.dat')

The type function displays the contents of the file.

Alternatively, use command syntax for the save operation.

save username_lab4_matrixA.dat x y -ascii

2. save them to -tabs
   '-ascii','-tabs' means Tab-delimited text format with 8 digits of precision.

   save('username_lab4_matrixA.dat','x','y','-ascii','-tabs','-v6','-append')
   username_lab4_matrixA.dat -- File Name
   'x','y' - values
   '-ascii','-tabs'
   '-v6' -- version number
   


3.Use the dlmwrite command

dlmwrite('username_lab4_t.out',t,';')
username_lab4_t.out -- file name
   t   is variable
   ;   delimeter    

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote