I have a homework assignment and i'm trying to figure out some functions that could help me write the matrix in this form (on that link i posted) like if i wanted to make a row with 1000 ones and not have to write 1 a thousand times.. In my class they don't teach us the software so yeah, any help will be appreciated, thank you.
No products are associated with this question.
We don't make homeworks, we only help with answers to specific questions and if we are kind enough we might give some tips:
doc ones %execute this to see the documentation of the function ones doc zeros %execute this to see the documentation of the function zeros
m=zeros(10,10); %create one array with 10 rows and columns full of zeros m(5,:)=1; %all columns (:) from row number 5 are now equal to 1 m %see the array
Like I said in my response to your post of this in the newsgroup:
Alan: To set an entire row to a value:
M(rowNumberToSet, :) = theValue;
M(42, :) = 2.718281828;
To set an entire column so a value:
M(:, columnNumberToSet) = theValue;
M(:, 69) = 3.14159;
This is basic MATLAB stuff - the stuff you learn the first couple of hours into it. You should find it early on in the "Getting Started" section of the help.