Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

There is a file called mat1.txt in our CatCourses files area under the Assignments folder. Download it and save it in the same folder where

There is a file called mat1.txt in our CatCourses files area under the Assignments folder. Download it and save it in the same folder where this Matlab file (HW08_01.m) is saved. It may be worth opening that text file to see how it is set out. Write a Matlab script that does the following (obviously, the order will need adjustment): Prompt the user for an input file name and read the user's input to a string variable. Note that using the input function will require the 's' argument to let it know the user will enter a string. Declare an array that is 55 and initialize each element with the value 0. The zeros function can do this in one step. Open the file name the user has entered for reading and use a loop to and read the values into your array. Close the input file. Use a separate loop to print the array to the console in a neat table. The output should show 4 digits to the right of the decimal place and use no more than 10 characters for each number.

mat1.txt

16.2182 60.1981 45.0541 82.5816 10.6652

79.4284 26.2971 8.3821 53.8342 96.1898

31.1215 65.4079 22.8976 99.6134 0.4634

52.8533 68.9214 91.3337 7.8175 77.4910

16.5648 74.8151 15.2378 44.2678 81.7303

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions