Problem 44380. ASCII Birthday Cake
Solution Stats
Problem Comments
-
4 Comments
can anyone check my solution 1292494. it look like when i convert to string it add a space before EOL (ascii 10).
I don't find from where it came
Maybe it comes from the new matlab strings introduced only recently in R2017a. You can notices them by the 'string' constructor and the double quotes in the test cases.
String concatenation and some other things seem to work differently for them, than for the good old char arrays.
maybe you right. the question is how i can remove it after or during the construction?
I found the difference and add a patch (cost me 50 in length)
Solution Comments
-
1 Comment
my function works on my computer and produce correct results.
but the test suit says it doesn't (no function or code error).
-
1 Comment
nice one!
-
2 Comments
When I run the assertions in MATLAB, they all come out true. Could you please help me figure out what is going wrong in Cody?
The problem is with new "string" type in Matlab and "Starting in R2017a, you can create strings using double quotes" --manual.
Thus length("CODY") = 1 vs strlength("CODY") = 4
and string(["aa" "bb" "cc"]) is 1x3 string array which is not correct answer. (check strjoin function)
-
1 Comment
Getting this one right on a version of MATLAB without the "string" capability was painful. I didn't know you couldn't convert a string to numbers by doing the string-0 trick like you can with char...
-
1 Comment
It look like when i convert to string it add a space before EOL (ascii 10).
I don't find from where it came and don't see where i can remove it.
Problem Recent Solvers215
Suggested Problems
-
1785 Solvers
-
Renaming a field in a structure array
1194 Solvers
-
Implement simple rotation cypher
1033 Solvers
-
Remove element(s) from cell array
1039 Solvers
-
2901 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!