Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (bgrg007):

Matlab help! If I were to have the user input for a matrix, what would be the first few steps to do so?

OpenStudy (e.mccormick):

I do not know matlab, but the commands seem straightforward for getting inputs: http://www.mathworks.com/help/matlab/ref/input.html

OpenStudy (bgrg007):

yes, i don't know how i could refer to a specific row or specific column by this method.

OpenStudy (anonymous):

First ask them for the dimensions, row and column

OpenStudy (anonymous):

Then print out the row and column and ask for the input

OpenStudy (bgrg007):

could you show an example? I don't know how I could create the dimensions of a matrix without having any values inside of it.

OpenStudy (anonymous):

Ask them for the number of rows, then for the number of columns

OpenStudy (anonymous):

``` rows = input('How many rows?'); columns = input('How many columns?'); matrix = zeroes(rows, columns); ``` The last line will create a matrix of all zeroes with the correct dimensions. Then you just need to ask for input for each cell.

OpenStudy (bgrg007):

I see. Thank you

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!