Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a matlab function that will work for ALL test cases for the following description. Function Name: arr2text Inputs: (double) A non-empty array of positive

Write a matlab function that will work for ALL test cases for the following description.image text in transcribed

Function Name: arr2text Inputs: (double) A non-empty array of positive integers (char) A filename Outputs: none File Outputs: A formatted table containing the array values Function Description: Sometimes it is important to be able to share formatted data but you don't have the luxury of being able to send an Excel sheet, Word document or any other type of rich-text document. In these cases, a plain-of' text file will have to suffice. However, your tables can still look good! In this problem, you will be given an array of data that you need to convert into a formatted table and write that table to a text file. Here's the specification for the formatting: Each column of the table should be the width of the largest number in that column. Each row should be delimited by -'s Each column should be delimited by |'s The intersection of the row and column delimiters should be +'s All numbers should be left-aligned in their cell and padded with spaces The formatted array should be written to a file specified by the second input. Here is an example: array = [45, 78923, 3; ... 8923, 9, 8] file Name = 'example.txt' After the function runs, a file named example.txt should be created containing the following: Notes: The file should not have an extra new line at the end. You can run the solution function to see the files created if you need more examples. When running the solution function, use a different filename than the one used in your code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions