Why this solution isn't correct? I tried this code on Matlab for pc and it's run correctly, but here on Matlab Cody's platform, it doesn't run. Someone can help me? Thanks
Look at the errors—your function never defines the output variable y.
Thank you for the help
y = [x(1),x(end)];
#strcat(x(1),x(length(x)));
very easy like it!
Well, I guess my understanding that string is defined using (" " , i.e. double quotations) is incorrect. I thought class string was formally distinguished from char (defined using ' ', i.e. single quotes). I should have looked at the test-suite.
Yes, the title should be "Return the first and last character of a char array"
Nice!
Only need:
out = x([1 end])
This is legal even if length(x) == 1, because in that case, x(1) == x(end)
that is it
What is the next step in Conway's Life?
639 Solvers
Remove the small words from a list of words.
672 Solvers
Remove the polynomials that have positive real elements of their roots.
629 Solvers
Renaming a field in a structure array
731 Solvers
337 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!