Q:

Create a 3 x 6 matrix of random integers, each in the range of 50 - 100. Write this to a file called randfile.dat. Then, create a new matrix of random integers, but this time make it a 2 x 6 matrix of random integers, each in the range of 50 - 100

0

 Create a 3 x 6 matrix of random integers, each in the range of 50 - 100. Write this to a file called randfile.dat. Then, create a new matrix of random integers, but this time make it a 2 x 6 matrix of random integers, each in the range of 50 - 100. Append this matrix to the original file. Then, read the file in (which will be to a variable called randfile) just to make sure that worked!

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

>> mat = randi([50,100], 3,6)

mat =

 91 96 64 99 98 57

 96 82 77 58 74 71

 56 54 98 99 90 96

>> save randfile.dat mat -ascii

>> newmat = randi([50,100], 2,6)

newmat =

 90 83 93 84 87 83

 98 51 97 88 70 58

>> save randfile.dat newmat -ascii -append

>> load randfile.dat

>> randfile

randfile =

 91 96 64 99 98 57

 96 82 77 58 74 71

 56 54 98 99 90 96

 90 83 93 84 87 83

 98 51 97 88 70 58

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now