The test suite needs to call the function, so that the matrix T will be available for testing.
Ooops! I see now that the function is called, but it looks like a program comment "%%T = user_function"
That's weird, it shows as a %% comment, but in the problem editor it is not. I've asked MathWorks about this.
A %% needs to be added before the first line. Otherwise, the server parses that first line of the test suite as a comment. I've fixed it here; feel free to fix this problem wherever else it occurs in problems you've created.
@goc3 that broke my test! Seems there is some implicit scoping rule, by adding the %% it means that T is not available in subsequent %% cells. Fixed it by calling the user function multiple times. This stuff is not well documented: the scoping rules, the need for a leading %% etc.
Sorry for any confusion that may have been caused. Yes, there may be a need for more detailed explanations of some site functioning, but that is beyond my power. For what it's worth, the scoping rule is consistently applied for all problems on the site: variables called within each test case are only available to that test case. I (and many other problem creators) end up repeating lines for any required variables within each test case.
The %% is an issue because it is so poorly documented and hence poorly understood (or even not understood). The following seems to be how it works. [Note: in the following I will use "↲" to indicate the end of a line in the code/output.]
Creator writes this TEST SUITE:
%% test 1↲
%% test 2↲
Cody RUNS the following tests:
Test 1: (i) commandA; (ii) commandB; and (iii) commandX.
Test 2: (i) commandA; (ii) commandB; and (iii) commandY.
Cody DISPLAYS the following output:
%% test 1↲
[output from commandX only]↲
%% test 2↲
[output from commandY only]↲
Notice: (i) any commands before the first %% [namely commandA and command] are run at the beginning of every test; (ii) output of any commands before the first %% is suppressed [never displayed]; (iii) for the player, a spurious "%%" is displayed on the first line of the Test Suite if there were any commands before the first "%%".
It is actually a very clever structure for Problem Creators writing a Test Suite. Therefore I'd be keen to retain it. See e.g. https://www.mathworks.com/matlabcentral/cody/problems/44655
The annoyances are: (i) lack of documentation; (ii) suppression of output; and (iii) insertion of a spurious "%%" in the display.
Although none of these three issues affect the running, they cause a lot of confusion and misunderstanding.
I don't really understand where I went wrong. I thought SSW means 202.5 degrees. So, I made 202.5 as my theta.
My matrix was (cos(202.5),-sin202.5,123;sin202.5,cos202.5,-74.6;0,0,1
Zeyue Xia you should use cosd and sind functions because you've specified the rotation angle in degrees not in radians.
Length of a short side
Hard limit function
Digit concentration in Champernowne's constant
Invert a 3D rigid-body transformation
Homogeneous lines and points in 2D: problem 1
Relative points in 2D: problem 3
Twists in 2D
Pose interpolation in 2D
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office