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?
It was so hard to think the solution, there are any other solutions?
function B = your_fcn_name(value,row,col)
G = digraph(row,col);
B = full(adjacency(G));
B = B*value;
B=B(1:max(row),1:max(col));
end
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
Not sure if reshape is allowed. But desciption do not prohibits it.
I am so proud of myself for solving this problem. :)) Nice challenge! :D
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?
Overwrites assert.m
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).
1293 Solvers
314 Solvers
237 Solvers
254 Solvers
Arrange vector in ascending order
629 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!