I need help indexing
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 = [changePrice]; % FIXME
% Assign newPriceTable column specified by colNum with original price
% data updated by changePrice
newPriceTable = newPriceTable + origPriceTable(:, colNum);
%+ origPriceTable(:, colNum);
%[ 0, 0; 0, 0; ]; % FIXME
end

4 commentaires

Stephen23
Stephen23 le 27 Oct 2017
@Blair Hall: what is your question?
Jan
Jan le 27 Oct 2017
@Blair: You got several comments to your list of questions already, which suggest to use another approach to solve your very basic Matlab questions, e.g. https://www.mathworks.com/matlabcentral/answers/360407-i-need-help-with-this-logic-array?s_tid=prof_contriblnk. Unfortunately you ignore these suggestions. You do not even spend the time for formulating your specific problem, but copy the original question text and some more or less meaningless and random code lines.
This is a very inefficient way to learn Matlab and it is not successful obviously. It wastes your time and the time of the members of the forum. Please choose a better way to learn Matlab, most of all one which works for you.
Blair Hall
Blair Hall le 27 Oct 2017
This is the question
Column indexing: Updating price tables using a single colon. Column array origPriceTable cotains the price per pound of various deli items. Column array changePrice indicates price adjustments for a given column. Assign newPriceTable with origPriceTable plus the newPriceTable added to origPriceTable's column colNum. Ex: If origPriceTable is [19.99, 9.99; 14.99, 8.99;], changePrice is [ -1.00; -1.50; ], and colNum is 1, then newPriceTable is [18.99, 9.99; 13.49, 8.99;].
Stephen23
Stephen23 le 27 Oct 2017
Modifié(e) : Stephen23 le 27 Oct 2017
@Blair Hall: no, that is not our question about how to use MATLAB, because that is actually your homework question. We are not a free homework service, nor a free MATLAB tutorial service.
As you have been told many times in your other very similar questions, you actually need to learn how to use MATLAB, and put in some effort yourself. There are plenty of guides and tutorials to help you learn how to use basic MATLAB, and they are easy to find using your favorite internet search engine.
If you have a specific question or your code is doing something unexpected, then we will be happy to help you.

Connectez-vous pour commenter.

Réponses (0)

Catégories

Tags

Modifié(e) :

le 27 Oct 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by