test02_spring08_1

test02_spring08_1 - . % (Dont manually change numbers, use...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% 4/19/11  % Test 2 Sprimg08 #1  % Input/Output: Write a script that reads in the following text file  % 1, 2, 3, 4, 5, 6, 7, 10, 23, 34, 59, 60, 70, 80, 100, 1, 2, 4, 7  % and changes the value of every number that is between 45 and 65 with the   % number 25, and then write the new set of numbers to a file call Temp2.txt
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: . % (Dont manually change numbers, use a for loop) Temp2.txt should look like % 1, 2, 3, 4, 5, 6, 7, 10, 23, 34, 25, 25, 70, 80, 100, 1, 2, 4, 7. a = dlmread('temp.txt'); for i = 1:length(a) if (a(i) > 45) && (a(i) < 65) a(i) = 25; end end dlmwrite('temp.txt', a)...
View Full Document

Ask a homework question - tutors are online