Question: **MATLAB** Help please with these two questions please The simple function below requires some debugging. You will need to identify issues with both the functionality

**MATLAB**\

**MATLAB**\ Help please with these two questions please The simple function belowrequires some debugging. You will need to identify issues with both thefunctionality and the style of the code. The purpose of the function

Help please with these two questions please

The simple function below requires some debugging. You will need to identify issues with both the functionality and the style of the code. The purpose of the function CopyToFile is to simply take one file as input, read the contents of this file, and write these contents out to a different file, in the exact same style. The function takes two inputs. The first is the full name and extension of the file to read from, and the second is the full name and extension of the file to be created and written to. Both of these arguments will be strings. The function CopyToFile is stored in FileCopyFunction.m. The content of FileCopyFunction.m is given below. = 1 function (success] CopyToFile(filename, output) 2 3 read_fid = fopen(filename, 'w') 4 W = fopen(output, 'w') 5 6 line = fgetl(read_fid) 7 8 while (ischar(line)) 9 fprintf('%s ', line); 10 line = fgetl(w); 11 end 12 13 read_closed fclose(read_fid); 14 write_closed = fclose(w); 15 16 if read_closed == 0 && write_closed == 0 17 success == 1; 18 else 19 success == 0; 20 end a) Identify four problems with style in CopyToFile. You should refer to line numbers and explain how to fix them. You may write code if you want, but it is not necessary to completely rewrite the function, you just need to explain how you would fix the style problems. (9 marks) b) Identify four bugs in CopyToFile. You should refer to line numbers and explain how to fix them. You may write code if you want, but it is not necessary to completely rewrite the function, you just need to explain how you would fix these bugs. (9 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!