{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

dlmCalc - %usage dlmCalc(fn data = csvread(fn%reads in the...

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

View Full Document Right Arrow Icon
function dlmCalc(fn) % Given a comma-seperated file containing an Mx2 array of doubles, write a % function dlmCalc that adds a third column to the original array. The third % column should be the product of first and second columns. Then, write the % new array to a tab-seperated file. The new filename should be the % original filename with the suffix '_edited.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: %usage: dlmCalc(fn) data = csvread(fn); %reads in the data from the csv file col = prod(data')'; %creates a column vector of the product of the columns data = [data col]; %concatenates the original data array with the newly created column vector dlmwrite([fn(1:end-4) '_edited.txt'],data,'\t'); %creates the new filename...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online