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

A file floatnums.dat has been created for use in an experiment. However, it cont

ID: 3533841 • Letter: A

Question

A file floatnums.dat has been created for use in an experiment. However, it contains float(real) numbers and what is desired instead is integers. Also, the file is not exactly in the correct format; the values are stored columnwise rather than rowwise. For example, if the file contains the following:


90.5792      27.8498     97.0593

12.6987      54.6882     95.7167

91.3376      95.7507     48.5376

63.2359      96.4889     80.0280

9.7540         15.7613     14.1886


what is really desired is:


91      13      91     63      10

28      55       96    96       16

97      96       49    80       14


Create a data file in the specified format. Write a script that would read from the file floatnums.dat into a matrix, round the numbers, and write the matrix in the desired format to a new file called "intnums.dat."

Explanation / Answer

to write the file.. use the function..
fwrite(fileID, A, precision)


here is a link to the website for detailed information.. (irrespective of whether u want to save it in binary or float or anyother)

http://www.mathworks.in/help/matlab/ref/fwrite.html

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