The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: nchoosek all pairwise combinations
Replies: 10   Last Post: Nov 27, 2012 7:46 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 6,677
Registered: 2/7/05
Re: nchoosek all pairwise combinations
Posted: Nov 27, 2012 5:32 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 11/27/2012 4:29 AM, Jos (10584) wrote:

> I did not see the word cell matrix in the OP message ...

Well, they are characters and need to be in a 'matrix',
so I assumed it has to be a cell array.

> but "much more work" is rather overstated:
> A = 'abcde'
> [B1, B2] = ndgrid(A)
> M = reshape(cellstr([B1(:) B2(:)]),5,5)

Nice. I did not know about cellstr. That is definitly
better. 2 lines shorter than mine :)


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.