12.3k views
4 votes
Function newPriceTable = UpdatePriceTable(origPriceTable, changePrice, colNum) % UpdatePriceTable: Adds changePrice to column colNum of origPriceTable % Returns the updated price table newPriceTable % Inputs: origPriceTable - original price data table % changePrice - column array of pricing changes % colNum - specified column of priceTable to update % % Outputs: newPriceTable - updated price data table % Assign newPriceTable with data from priceTable; newPriceTable = [0, 0; 0, 0;]; % FIXME % Assign newPriceTable column specified by colNum with original price % data updated by changePrice newPriceTable = [0, 0; 0, 0;]; % FIXME end Run Your Solution Code to call your function when you click Run

User Bade
by
4.7k points

1 Answer

3 votes

Solution :

The function code is :

function newPriceTable = UpdatePriceTable(origPriceTable,changePrice, colNum)

newPriceTable = origPriceTable:

newpriceTable(:,colNum) = newPriceTable(:,colNum)+changePrice;

end

UpdatePriceTable ([19.99, 9.99; 14.99, 8.99;], [-1.00, -1.50] , 1)

ans = 18.9900 9.9900

13.4900 8.9900

User StFS
by
4.5k points