MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > Symmetrical binary matrices: a help from an expert 

Subject: Symmetrical binary matrices: a help from an expert From: Paulo Guimaraes Date: 27 Jan, 2011 21:27:04 Message: 1 of 16 
Hi guys, 
Subject: Symmetrical binary matrices: a help from an expert From: Bruno Luong Date: 27 Jan, 2011 22:42:04 Message: 2 of 16 
Try this: 
Subject: Symmetrical binary matrices: a help from an expert From: Bruno Luong Date: 27 Jan, 2011 23:30:10 Message: 3 of 16 
My previous code only works for n even. I'll think more about other cases. 
Subject: Symmetrical binary matrices: a help from an expert From: Paulo Silva Date: 28 Jan, 2011 00:55:05 Message: 4 of 16 
Here's one of the ways, it works fine for odd and even rows, just keep n small 
Subject: Symmetrical binary matrices: a help from an expert From: Paulo Silva Date: 28 Jan, 2011 01:10:05 Message: 5 of 16 
Just a few corrections 
Subject: Symmetrical binary matrices: a help from an expert From: Bruno Luong Date: 28 Jan, 2011 06:21:03 Message: 6 of 16 
"Paulo Silva" wrote in message <iht51d$evh$1@fred.mathworks.com>... 
Subject: Symmetrical binary matrices: a help from an expert From: Paulo Silva Date: 28 Jan, 2011 07:04:04 Message: 7 of 16 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ihtn8f$n7j$1@fred.mathworks.com>... 
Subject: Symmetrical binary matrices: a help from an expert From: Bruno Luong Date: 28 Jan, 2011 07:13:04 Message: 8 of 16 

Subject: Symmetrical binary matrices: a help from an expert From: Paulo Silva Date: 28 Jan, 2011 07:30:12 Message: 9 of 16 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ihtq9v$7m7$1@fred.mathworks.com>... 
Subject: Symmetrical binary matrices: a help from an expert From: Bruno Luong Date: 28 Jan, 2011 08:14:04 Message: 10 of 16 
Here is a solution for the number of one (m) even 
Subject: Symmetrical binary matrices: a help from an expert From: Bruno Luong Date: 28 Jan, 2011 08:27:03 Message: 11 of 16 

Subject: Symmetrical binary matrices: a help from an expert From: Paulo Silva Date: 28 Jan, 2011 08:29:04 Message: 12 of 16 
Here's a brute force way to find solutions 
Subject: Symmetrical binary matrices: a help from an expert From: Paulo Silva Date: 28 Jan, 2011 08:42:03 Message: 13 of 16 
nice code and conclusion Bruno, I leave here my brute force code with speed improvements so people can confirm your conclusions :) 
Subject: Symmetrical binary matrices: a help from an expert From: Bruno Luong Date: 28 Jan, 2011 22:00:07 Message: 14 of 16 
Here is the algorithm put together: 
Subject: Symmetrical binary matrices: a help from an expert From: Bruno Luong Date: 28 Jan, 2011 22:45:06 Message: 15 of 16 
Just a note that if randomize matrix is needed, then add these commands at the end: 
Subject: Symmetrical binary matrices: a help from an expert From: Bruno Luong Date: 29 Jan, 2011 08:13:03 Message: 16 of 16 
Here is a full vectorized code: 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.