Hauptinhalt

Results for


When solving problems over on Cody, I can almost always view all solutions to a problem after submitting a correct solution of my own. Very rarely, however, this is not the case, and I instead get the following message:
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
You may solve another problem from Community group to unlock all the solutions to this problem.
If this happens, then again, I can almost always rectify this by submitting a (correct) solution to a different problem (I take it that the Community group is the implicit group of all problems on Cody --- is it?). But sometimes that, too, fails.
So my question is, why? What are the criteria that determine when all solutions are, in fact, unlocked?
(There is a related question here, but I feel the posted answer does not answer the question.)
Simple question: I noticed there's a Modeling & Simulation Challenge Master badge over on Cody, but I can't find the corresponding group. So: where is it? Does it still exist at all?
Error: The server timed out while running and assessing your solution in MATLAB CODY. How do I resolve this? My code is correct. I have run it on PC. But, when i submit in CODY the server throws an error.
4 weeks of contests is fun but intense. Next, we recommend 3 things to do as warm-down exercises.
To make future contests better and more appealing to you, we created a 1-minute survey to understand your experience. Your feedback is critical to us!
2. Read 2022 Mini Hack Content Analysis blog post by Dave Bulkin
Dave Bulkin is a developer on the MATLAB Graphics and Charting Team. In the Blog post, @Dave B not only examines the code behind the leading entries, but also introduces you to some new visualization techniques.
Matt Tearle is from MathWorks Training Services Team. @Matt Tearle created this problem group to celebrate the 10th anniversary of Cody and the 2022 T20 World Cup (which happened to occur at the same time). Note that the problems can be done without the knowledge of cricket.
Thank you in advance and hope to see you in 2023!
I've now seen linear programming questions pop up on Answers recently, with some common failure modes for linprog that people seem not to understand.
One basic failure mode is an infeasible problem. What does this mean, and can it be resolved?
The most common failure mode seems to be a unbounded problem. What does this mean? How can it be avoided/solved/fixed? Is there some direction I can move where the objective obviously grows without bounds towards +/- inf?
Finally, I also see questions where someone wants the tool to produce all possible solutions.
A truly good exposition about linear programming would probably result in a complete course on the subject, and Aswers is limited in how much I can write (plus I'll only have a finite amount of energy to keep writing.) I'll try to answer each sub-question as separate answers, but if someone else would like to offer their own take, feel free to do so as an answer, since it has been many years for me since I learned linear programming.
The 2022 community contests have concluded! During the 4 weeks, we hope you had a lot of fun and learned some MATLAB skills. Together, we've achieved amazing milestones:
  • 500+ entries and 5,000+ votes created in the Mini Hack 2022 contest.
  • 100,000+ solutions submitted in Cody 10th Anniversary contest
  • 2,000+ participants in both contests
Now, it's time to announce weekly winners and grand prize winners!
Mini Hack - Pick of the MATLAB Graphics Team
We invited the MATLAB Graphics team, the authors of the MATLAB functions used in every entry, to be our Mini Hack judges. Here are their picks in 3 categories:
  • Our Top 3:
Rising Hand by Augusto Mazzei
Object used: fill; Judge comments: Clever code, nice metaphor, kind comments
Object used: patch (via VOXview); Judge comments: Very pretty, looks like it could be in a video game
Monocular rivalry by Jenny Bosten
Object used: Image; Judge comments: We spent a too much time trying to figure out what this illusion was doing to our brains
  • Clever use of Charts:
Object used: Bar3; Judge comments: Cute! Nice fireworks!
Ship by Shanshan Wang
Object used: histogram2; Judge comments: We didn't realize there was a ship in the flow data set
A fish for fun by Shanshan Wang
Object used: plot; Judge comments: Nifty and very different from other entries.
Colorful Fibonacci Spiral #3 by Basil Imoberdorf
Object used: scatter; Judge comments: Overlapping markers make for a very cool tunnel-like effect
  • Things we still loved:
Sandstone by Tim
Object used: image; Judge comments: Domain Warping FTW
Jellyfish by Tim
Object used: surface; Judge comments: Clever use of transparency
Congratulations and you should be very proud of yourself! It's a huge achievement that your entry is recognized by the MATLAB Graphics team!
Mini Hack - special category for Week 4
Our Week 4 special category is ‘Holiday’. The winner is Christmas snowman by Simon Thor
Mini Hack - grand prize winners
After an intensive (and very time-consuming) review of votes on winning entries, we have finalized the list of grand prize winners. Huge congratulations! We appreciate the time and effort you spent and the awesome entries you created. Each of you won an Amazon gift card.
Anton Kogios, Brandon Caasenbrood, KARUPPASAMYPANDIYAN M, Teodo, Jenny Bosten, MvLevi, Abdullah Caliskan, Stewart Thomas, Jonas Schlatter, and Tim Davis
Cody 10th Anniversary - surprise prize for 28-day streak winners
We are thrilled to see that 37 players have built a streak of 28 days! Coming back every day to solve problems is an incredible achievement. We decided to show our appreciation by awarding a surprise prize to those 37 players. Congratulations! Each of you will get a MathWorks T-shirt.
Christian Schröder, Stefan Abendroth, Mohammed, Victoria, Vasileios Pasialis, Gerardo Domínguez Ramírez, HH, Anton Kogios, Lizhi Zhu, Marco Fuscà, Armando Longobardi, Monica, Rithik KRT, Ayman, Teodo, Lincoln Poon, Elijah Keifert, siranjeevi gurumani, kazuyoshi kouno, Ryan Koh, Manuela Kaiser, Mehmet OZC, Dyuman Joshi, KOTHAPALLI SRI BRINDA, Gergely Patay, abyss, Takumi, Keita Abe, Petr Cerny, Shubham Shubham, Meredith, Andrew K, Atsushi Ueno, Peter Orthmann, Armando Longobardi, Chuang Tao, and David Romero
Cody 10th Anniversary winners – Week 4
The top 3 players for solving the most problems in week 4 are Christian Schröder, Gerardo Dominguez Ramirez, and Stefan Abendroth, Congratulations! Each of you won an Amazon gift card.
Week 4 lucky winners are Qingrui Liu and Basant Ale.
Cody 10th Anniversary winners – grand prize winners
We know how hard it is to be a top-10 leader in the contest leaderboard! It requires a huge time commitment and advanced MATLAB skills. Congratulations! Each of you will win an Amazon gift card.
Christian Schröder, Stefan Abendroth, Mohammed, Victoria, Vasileios Pasialis, Gerardo Domínguez Ramírez, HH, Anton Kogios, Lizhi Zhu, and Marco Fuscà
Lucky voters and participants
Thank you for your participation in our 2022 contests. You don’t need to be on the top of the leaderboards to win. As we announced, we would give out 20 MathWorks T-shirts to lucky voters and participants of the 2 contests.
Ismail Bera Altan, Robin Stolz, Michael Mellin, Kellan Smith, Neha Shaah, Siranjeevi gurumani, Paul Villain, Andrew Horchler, Meg Noah, Saurabh Chaudhary, Pakize erdogmus, Godfrey Ojerheghan, Selena Mastrodonato, Damir Rasic, Thomas Kjeldsen, Meredith, John Noah Ramiterre, Patience Oliveira, Panda, and Sujeet Kumar Choudhary
On behalf of the MATLAB Central community team, we thank you for joining our celebration of the MATLAB Central community 2022 contests. We hope you enjoyed these contests and look forward to seeing you in next year’s contests.
In Week 3, several new milestones have been achieved! Cody 10th contest has reached the 80,000-solution milestone! Mini Hack has over 400 entries. @Tim Davis’ seashell entry actually inspired a MathWorks blog post. Check it out.
During the last week of this contest, we strongly encourage you to inspire your colleagues, classmates, or friends to vote. Let the world know the beauty of Mathematics. Voters will also have the opportunity to win a MATLAB T-shirt.
MATLAB Mini Hack Winners - Week 3
In week 2, we announced the special category for week 3 is nature. Below are the 3 winners for this category.
Winners of other categories are:
Congratulations! Each of you won a T-shirt. I just heard we have 4 designs of MATLAB T-shirts. Can you collect all of them?
Cody 10th Anniversary Winners - Week 3
  • The top 3 players for solving the most problems in week 3 are Christian Schröder, Marco Fuscà, and Stefan Abendroth, Congratulations! Each of you won an Amazon gift card.
  • As long as you participate, you have the opportunity to win MathWorks T-shirts. Week 3 lucky winners are Luffy Wangand Augusto Mazzei.
What’s new in week 4?
MATLAB Mini Hack 2022:
  • Week 4’s new category is holiday! Halloween is around the corner. What holidays are you celebrating?
  • You are able to leverage Signal Processing Toolbox in your entry.
Cody 10th Anniversary:
Want a MATLAB T-shirt? We have 10 more to give out in the 10 days between now and Oct. 30th. You might win a MATLAB T-shirt by doing any of these activities:
  • Vote on entries you like from the Mini Hack contest
  • Solve Cody problems in the Cody 10th contest
  • Create or remix entries in the Mini Hack contest
The more activities you do, the higher your chance to win. Every day, we will pick a winner.
We had another wonderful week of community contests 2022. In week 2, the voting for Mini Hack started! About 1000 votes have been cast on 300+ entries. In Cody 10th Anniversary contest, we already have 85 finishers for the two special groups: Matrices and Arrays and Plotting and Visualization.
Now, it’s time to announce the weekly winners!
MATLAB Mini Hack Winners - Week 2
Amazing entries keep coming in every day. In week 2, we announced a space category to celebrate the milestone of NASA’s Dart mission. We’ve picked 4 winners for this new category.
Winners of other categories are:
Congratulations! Each of you won a MathWorks T-shirt. If this is the second time you won, you have the option to choose a MathWorks hat or a coffee mug!
Cody 10th Anniversary Winners - Week 2
  • The top 3 players for solving most problems in week 2 are Mohammed, Armando Longobardi, and Stefan Abendroth, Congratulations! Each of you won an Amazon gift card.
  • You don’t need to be an expert or spend tons of time to win! As long as you participate, you have the opportunity to win MathWorks T-shirts. Week 2 lucky winners are Dylan Baker and Takumi.
What’s new in week 3?
MATLAB Mini Hack 2022:
  • Week 3’s new category is nature! We look forward to seeing more nature-themed creative entries from you!
  • You are able to leverage up to 2 File Exchange submissions in your code.
Cody 10th Anniversary:
You might have read the news that NASA successfully crashed a spacecraft into an asteroid to alter the asteroid’s course. But did you know the spacecraft’s autonomous guidance system was developed in MATLAB and C++? Check out our latest blog post to learn more details.
Let’s celebrate this scientific milestone by creating astronomy-themed entries in the Mini Hack contest. Be creative and leverage the existing submissions in File Exchange. We will award special prizes to the best entries.
Just in one week, 200 amazing images were created in the Mini Hack contest and 20,000 solutions were submitted in the Cody contest. What an amazing week! Time to announce the winners.
MATLAB Mini Hack Winners - Week 1
Your awesome work made our judging VERY HARD! We came up with several categories for winning entries. Congratulations to the winners! Each of you won a MathWorks T-shirt:
Cody 10th Anniversary Winners - Week 1
  • The top 3 players for solving most problems in week 1 are Mohammed, Stefan Abendroth, and Hans Bourgeois. Congratulations! Each of you won an Amazon gift card.
  • You don’t need to be an expert or spend tons of time to win! As long as you participate, you have the opportunity to win MathWorks T-shirts. Week 1 lucky winners are Meredith Reid and KARUPPASAMYPANDIYAN M.
In Week 2, we’ve added more fun to the contests!
MATLAB Mini Hack 2022:
  • Voting started. Cast your votes on your favorite images. Help us show the world the beauty of mathematics by sharing your work with your friends, classmates, or colleagues.
  • Toolboxes unlocked. You are able to leverage the Image Processing Toolbox to generate even more interesting images. We will award the best entries leveraging the Image Processing Toolbox.
Cody 10th Anniversary:
The contest development team has identified an issue when trying to link your new entries to submissions in the File Exchange. The issue has prevented some users from successfully linking their entries. We have a fix and will be deploying it today at 3pm EST.
Two fun community contests: MATLAB Mini Hack 2022 and Cody 10th Anniversary start today on Oct. 3rd!
Participants across all skill levels are welcome to join! Even if you have limited time, you still have opportunities to win as long as you participate.
Want to challenge yourself and win Amazon gift Cards and limited-edition Badges?
1. MATLAB Mini Hack 2022: Create your best entry (either a new or a remixed entry).
2. Cody 10th Anniversary: Solve your 1st Cody problem today!
If you have any questions about the contest rules or prizes, let us know by replying to this thread.
We hope you enjoy the contests, improve your MATLAB skills, and win prizes! Now, let the party begin!
Just in case, I have my license of MATLAB. I just have this question and I didn't find any information. I wouldn't like to create another account, for this reason I prefer to ask here.
Two fun community contests: MATLAB Mini Hack 2022 and Cody 10th Anniversary will start on Oct 3rd, 2022. Are you ready for the challenges and big prizes?
How to Play
1. MATLAB Mini Hack 2022 contest:
Use up to 280 characters of MATLAB code to generate an interesting image. New in 2022 contest: You'll be allowed to use functions from File Exchange entries and/or certain MathWorks toolboxes in different weeks.
2. Cody 10th Anniversary contest:
Solve at least 1 Cody problem per day during the 4-week contest period. We will reward participants with the longest streak of days of problem-solving!
Tips to Win
1. MATLAB Mini Hack 2022: Spend time creating your best work (either a new or remixed entry).
2. Cody 10th Anniversary: Make sure you start on the 1st day (Oct 3rd). This is the key if you want to win one of the grand prizes (worth marking your calendar?)
3. Act now: No matter if you want to join either the Mini Hack, Cody, or both. Start planning your strategy today.
Good luck! We hope you are the winner.
I have submitted a problem in cody some days back. Now it is not showing in my profile. Initially it was accepted and some people submitted the solutions also, however It has been removed after that, are there some guidelines which I am not following?
This is not a question, but a point of discussion for the entire community. I am aware that every 1/2 months this theme comes out, but until this is not fixed it is totally necessary that this comes, indeed, out. And I said "fix" because Mathworks has to understand that a dark theme is not only a visual/aesthetic matter, it is a substantial part of the game. Most of the OS, GUIs, programs are actually in dark mode, and a vast majority of the users makes indeed use of a global dark mode. How much one does like it is personal, but the benefits to power savings and eye health is instead a fact. Mathworks being ignoring this for years is nothing but ridiculous. Of course it is not an easy task, but every minute of committment for it is worthy. And nope, Schemer is not helpful because it does not provide a real fix to this question.
I feel free to suggest something similar to the Spyder's dark theme, which came out like 2 years ago if I remember correctly.
Of course, my point is not being disrespectful (I am instead very respectful to the huge efforts of Mathworks for making this wonderful program run). But, form a user's point of view, the fact that not a single word has so far come out from Mathworks about a dark theme (meaning that for sure we will not see it in a timing of months) requires us to put a strong pressure on this.
Mathworks, please: it's time for a dark theme.
Hi everyone
I am a new of this community and I very interested in this forum and Matlab.I am trying to submit a soultion but as tiltle my code has a built-in function so the test systerm dont reconisie it.It run completely ok on my computer.
This is problem
This is my solution
function [boOut] = BoIfPointInPoly(PolyMatrix,p_test)
%Summary of this function goes here
%{
if we draw a line from test point to a central point of a side of The polygon
then we extend that line to the furthest point of the polygon ensure that
line go through all side of Polygon in 1 direction.I call that line is line_test
Next find number of intersert of line test and all sides w polyxpoly
function
num interset point is odd mean p_test inside
num interset point is even mean p_test outside
this solution go from the concept that if a line go in from a side it has go out
from other side.So if it go in but not go out that mean it start from
inside.
%}
% Detailed explanation goes here
%line from p test throuh central of a side to furthest point of polygon
%find vector
V = ((PolyMatrix(1,:) + PolyMatrix(2,:)) /2) - p_test ;
%draw that vector to furtest point
pend = p_test + V * max(PolyMatrix(:));
%with multi of V and biggest element I assume that line will go all out the
%polygon which ensure out logic will right
line_test = [p_test ; pend];
disp('Our line test\n');
disp(line_test);
%find interst point
p_inter = polyxpoly(PolyMatrix(:,1),PolyMatrix(:,2),line_test(:,1),line_test(:,2));
%find number of interset (row)
[numIntere,trash] = size(p_inter);
disp('Number of interest point:');
disp(numIntere);
%determine in or out
if (rem(numIntere,2) == 0)
boOut = 0;
else
boOut = 1;
end
end
Can anyone has solution.
Introduction
Comma-separated lists are really very simple. You use them all the time. Here is one:
a,b,c,d
That is a comma-separated list containing four variables, the variables a, b, c, and d. Every time you write a list separated by commas then you are writing a comma-separated list. Most commonly you would write a comma-separated list as inputs when calling a function:
fun(a,b,c,d)
or as arguments to the concatenation operator or cell construction operator:
[a,b,c,d]
{a,b,c,d}
or as function outputs:
[a,b,c,d] = fun();
It is very important to understand that in general a comma-separated list is NOT one variable (but it could be). However, sometimes it is useful to create a comma-separated list from one variable (or define one variable from a comma-separated list), and MATLAB has several ways of doing this from various container array types:
1) from a field of a structure array using dot-indexing:
struct_array.field % all elements
struct_array(idx).field % selected elements
2) from a cell array using curly-braces:
cell_array{:} % all elements
cell_array{idx} % selected elements
3) from a string array using curly-braces:
string_array{:} % all elements
string_array{idx} % selected elements
Note that in all cases, the comma-separated list consists of the content of the container array, not subsets (or "slices") of the container array itself (use parentheses to "slice" any array). In other words, they will be equivalent to writing this comma-separated list of the container array content:
content1, content2, content3, .. , contentN
and will return as many content arrays as the original container array has elements (or that you select using indexing, in the requested order). A comma-separated list of one element is just one array, but in general there can be any number of separate arrays in the comma-separated list (zero, one, two, three, four, or more). Here is an example showing that a comma-separated list generated from the content of a cell array is the same as a comma-separated list written explicitly:
>> C = {1,0,Inf};
>> C{:}
ans =
1
ans =
0
ans =
Inf
>> 1,0,Inf
ans =
1
ans =
0
ans =
Inf
How to Use Comma-Separated Lists
Function Inputs: Remember that every time you call a function with multiple input arguments you are using a comma-separated list:
fun(a,b,c,d)
and this is exactly why they are useful: because you can specify the arguments for a function or operator without knowing anything about the arguments (even how many there are). Using the example cell array from above:
>> vertcat(C{:})
ans =
1
0
Inf
which, as we should know by now, is exactly equivalent to writing the same comma-separated list directly into the function call:
>> vertcat(1,0,Inf)
ans =
1
0
Inf
How can we use this? Commonly these are used to generate vectors of values from a structure or cell array, e.g. to concatenate the filenames which are in the output structure of dir:
S = dir(..);
F = {S.name}
which is simply equivalent to
F = {S(1).name, S(2).name, S(3).name, .. , S(end).name}
Or, consider a function with multiple optional input arguments:
opt = {'HeaderLines',2, 'Delimiter',',', 'CollectOutputs',true);
fid = fopen(..);
C = textscan(fid,'%f%f',opt{:});
fclose(fid);
Note how we can pass the optional arguments as a comma-separated list. Remember how a comma-separated list is equivalent to writing var1,var2,var3,..., then the above example is really just this:
C = textscan(fid,'%f%f', 'HeaderLines',2, 'Delimiter',',', 'CollectOutputs',true)
with the added advantage that we can specify all of the optional arguments elsewhere and handle them as one cell array (e.g. as a function input, or at the top of the file). Or we could select which options we want simply by using indexing on that cell array. Note that varargin and varargout can also be useful here.
Function Outputs: In much the same way that the input arguments can be specified, so can an arbitrary number of output arguments. This is commonly used for functions which return a variable number of output arguments, specifically ind2sub and gradient and ndgrid. For example we can easily get all outputs of ndgrid, for any number of inputs (in this example three inputs and three outputs, determined by the number of elements in the cell array):
C = {1:3,4:7,8:9};
[C{:}] = ndgrid(C{:});
which is thus equivalent to:
[C{1},C{2},C{3}] = ndgrid(C{1},C{2},C{3});
Further Topics:
MATLAB documentation:
Click on these links to jump to relevant comments below:
Dynamic Indexing (indexing into arrays with arbitrary numbers of dimensions)
Nested Structures (why you get an error trying to index into a comma-separated list)
Summary
Just remember that in general a comma-separated list is not one variable (although they can be), and that they are exactly what they say: a list (of arrays) separated with commas. You use them all the time without even realizing it, every time you write this:
fun(a,b,c,d)
I'm trying to solve one problem in Cody, but a function 'fmincon' is not recognized by the online compiler. Is there any way to use functions in optimization toolbox in Cody?