Problem 830. Fill a zeros matrix
Solution Stats
Problem Comments
-
9 Comments
Useful in practice !
There is an error in the statement of the problem: the matrix is the smallest that is compatible with the indices, and is not necessarily square.
how about including "regexp" in the forbidden commandlist?
"regexp" should be forbidden in this problem...ps:the forbidden is so powerful that I can put "zeros" word inside my function's comment.:lol
How about forbiding regexp?
I like it
In the problem, line 3 "square matrix" should have the "square" removed; plural of index will be indices... Nevertheless I like the problem especially with all those forbidden words.
funny
How can you iterate without a FOR loop?
Solution Comments
-
1 Comment
solution found in the comments
-
2 Comments
Why this isn't working??
function B = name(value,row,col)
row=row';
col=col';
z=zeros(max(row),max(col));
[ro,~]=size(row);
for ii=1:ro
for jj=1
h=row(ii,jj);
b=col(ii,jj);
z(h,b)=value;
end
end
B=z;
end
%considering the linear mapping of matrix index
function B = your_fcn_name(value,row,col)
B = 0*rand(row(end),col(end));
temp = row'+(col'-1)*row(end);
B(temp) = value;
end
-
1 Comment
Not sure if reshape is allowed. But desciption do not prohibits it.
-
1 Comment
I am so proud of myself for solving this problem. :)) Nice challenge! :D
-
2 Comments
Nice challenge. Learned how matrix indices are used
I have completed upto creating zero matrix but can't find anything specific to insert the values! any hints?
-
1 Comment
Overwrites assert.m
-
2 Comments
function B = your_fcn_name(value,row,col)
B(row,col)=value;
end
but it shows error pls help me
When row and col are vectors of length n, B(row,col)=value resets all combinations of row(i) and col(j) (a total of n^2 elements); the problem wants just row(i) and col(i) (a total of n elements).
Problem Recent Solvers568
Suggested Problems
-
Project Euler: Problem 3, Largest prime factor
1046 Solvers
-
Calculate the Hamming distance between two strings
298 Solvers
-
364 Solvers
-
Sum of first n positive integers
530 Solvers
-
556 Solvers
More from this Author30
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!