cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
mjaisit
Level I

Simple Matrix Extraction

Quick question about extracting a single column from a large matrix into a submatrix. Just as an example below: I want extract the second column from matrix P ( I want to pull out 2,5,8) and place it into a submatrix called A. However when I try to attempt it in this way, I am getting invalid matrix token error.

P=[1 2 3, 4 5 6, 7 8 9];

for(i=1,i<=3,i = i + 1,

  A = [P[i,2]];

);

Should be really simple, but for some reason it is stumping me. Thanks for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: Simple Matrix Extraction

Matt's pointing you in the right direction.

Here's a more specific set of documentation on Subsetting Matrices.

The answer at the end of the book is that a subscript argument of zero selects all rows or columns.

P=[1 2 3, 4 5 6, 7 8 9];

A=P[0,2];

-Jeff

-Jeff

View solution in original post

3 REPLIES 3
mattflynn
Level III

Re: Simple Matrix Extraction

Jeff_Perkinson
Community Manager Community Manager

Re: Simple Matrix Extraction

Matt's pointing you in the right direction.

Here's a more specific set of documentation on Subsetting Matrices.

The answer at the end of the book is that a subscript argument of zero selects all rows or columns.

P=[1 2 3, 4 5 6, 7 8 9];

A=P[0,2];

-Jeff

-Jeff
mjaisit
Level I

Re: Simple Matrix Extraction

Thanks guys for the quick help!

Recommended Articles