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

Matlab Loops Friday evening. Dream date waiting for you and your boss comes to y

ID: 3598135 • Letter: M

Question

Matlab Loops

Friday evening. Dream date waiting for you and your boss comes to your desk and says...

“ You know, someone made a mistake. We must update these 500 spreadsheets adding 50 to the existing value in cell B2. We (by that he means you) should do something about it, and it must be ready before we leave”

Use your Matlab skills to solve the problem and leave as soon as possible. Open the subset of these spreadsheets in W4Ex6 and save the contents in a folder. The script freedomscript.m should update the values in B2. Use help xlsread and help xlswrite to learn how to target specific cells and worksheets. (xlsread,for,sprintf,eval,xlswrite)

Explanation / Answer

clear all; filename = 'W4Ex6.xlsx'; cell='B2'; %path to save updated xlsx% new_filename= 'C:myFolderupdated_W4Ex6.xlsx'; for sheet= 1:500 %reads value in B2 cell% b2_val= xlsread(filename,sheet,cell); %writes to new path, adding 50 to B2 cell% xlswrite(new_filename,b2_val+50,sheet,cell); end