All solutions with score 11 or 12 use the regexp cheat.
Is there somewhere to go to receive advice on how to improve your code?
i can't think of a better solution having size less than 19!
why isn't B = (A(:,n)=[]); working? thanks
How to improvise this code?
It's very MATLAB!
this was actually not that difficult :)
a good way to learn
There should be a single-column input matrix in the test suite.
This was fun! Not difficult, but kind of challenging!
A(n,:)=[]; B = A; it works,but I'm wrong,who tell me the reason?
Better test cases could be provided for edge cases.
Great problem.
Lets you dug deep into the documentation for an awesome solution.
This link might help : https://in.mathworks.com/help/matlab/math/removing-rows-or-columns-from-a-matrix.html
Good problem
good
Good one
Why this is not working?
B = A ( : , ~=n)
I know logic operator needs something~=n but I cannot decide how to correct it? Also, I can write if statement in a for loop but its size is huge.
good
function B = column_removal(A,n)
A(:,n) = [];
B = A;
end
Can someone please tell me what is wrong with this code?
@Shivi, it does work.
GOOD
nice
innovative problem
These problems really test our knowledge.
function B = column_removal(A,n)
c=A'
c(n,:)=[]
A=c'
end
Why does my code solve the problem, but it is explicitly an error?
Remember to use () & [] correctly.
super task
A(:,n)=[];
B=A
Very good. I am new to Matlab. Thanks Mr. Piero Cimule.
Thanks!
great job
B = horzcat(A(1:end,1:n-1), A(1:end,n+1:end)); gives size 35.
How can we know the real leading solution sizes if there are those "message solutions" that are not real solutions?
please delete this solution
woooooooow! good job
I really need to learn to code better. I say this because I keep on getting size which is atleast 2-3 times the size of the leading solution.
larger size but will work for n=1
This would fail for n=1
VERY EASY
good stuff
good
B(n)=A[] ?
What am I doing wrong? Im new btw. Learning the basics.
What is the best optimized solution for this particular problem? Could someone with size 19 or smaller please indicate their solutions. Thanks
My code solves the problem, yet I get incorrect answer
Good one.
no need to use for loop or anything.
it's just this.
nice, I wish I had thought of it this way
nice
can anybody tell me why this solution is not working:"[a,b] = qr(A);
[a1,b1] = qrdelete(a,b,n);
y = a1*b1;"
Although it gives right answers to all test Suits in the software.Plz
because of rounding errors.
B = round(a1*b1);
it should work in this case as all numbers are integers.
B=A(:,1:end-1);
What is wrong here?
you are just removing the "last" column, not the "n-th" column.
I've checked this coding:"[a,b] = qr(A);
[a1,b1] = qrdelete(a,b,n);
B = a1*b1;" Why this not working??? Can anybody check this....
Hi, this code working good. then how to say it is incorrect?
Why the following solution doesn't work? It does on my MATLAB 2011a :
function B = column_removal(A,n)
if((n < 1) || (n > size(A, 2)))
B = A;
return;
end
if(n > 1)
l = A(:, 1:(n-1));
else
l = [];
end
if(n < size(A, 2))
r = A(:, (n+1):size(A, 2));
else
r = [];
end
B = [l,r];
end
oops ! didn't read the requirements right
i`m not really sure [] is faster than '' but is good to know
it seems that A(:,n)='' is a bit faster than A(:,n)=[]; but usually we use the latter one,
I can't believe it is this simple. lol.
Dear Oscar,
in comparison to your code, the below implementation is much faster but your style of code is a crack to cody system, well done.
function A = column_removal(A,n)
A(:,n) = '';
end
Dear Sadid, I agree with you that my implementation is completely stupid and a waste of time in real life and that's why I don't like the current evaluation metric of Cody. A (time and/or memory)-based evaluation would be much more interesting. With the current evaluation metric, Cody promotes hacking and cracking (which is also fine), but players don't learn good manners for developing efficient code.
NICE ONE BUT BIT DIFFICULT
@Óscar yes, you are right. the player can't study the one with well written style
agreed with Oscar
My MATLAB 2012a worked for #2
What happened to "and return the resulting matrix in output B"?
Strange: A(:,n) = [] has size 15 but is basically the same?
How safe is this to do?
function ans = column_removal(A,n)
A(:, n) = ''
end
Why doesn't this code work? :/
@Mechatrobrnotronik: I tested your code.
function ans = test_fkt(A,n)
A(:,n) = ''
end
Works for me. Returning A with removed column n.
Nonetheless I am interested in what '' actually does. I couldn't find it in the command reference.
fun
Can the server provide more information on failed solution?
For those who wonder how such low scores are being reported in Cody, it is because many players are changing the actual function call. The result is obvious to those of us who have solved many of these challenges.
Renaming a field in a structure array
840 Solvers
540 Solvers
Make a vector of prime numbers
312 Solvers
356 Solvers
convert matrix to single column
334 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!