Skip to main content
13-Aquamarine
August 6, 2026
Question

Matrix to unlinked matrix

  • August 6, 2026
  • 13 replies
  • 68 views

I would like to READTEXT from text file which would form a two-column matrix.  That part is easy.  Then I would like to copy the contents of the first matrix to a second matrix, then use that second matrix for other purposes, but unlinked to the first matrix.

13 replies

21-Topaz II
August 6, 2026

Hi,

Use copy and paste within the worksheet.  Make sure you only select the all matrix not including M=.  it will be highlighted in grey.  then copy.  type newM:=then paste.  The new matrix newM is now independent of the read.

Cheers

Terry

25-Diamond I
August 6, 2026

@terryhendicott 

Unfortunately, copy & paste in Prime is severely flawed.

In Prime only the visible part of the matrix is copied.
Unlike other software like real (=legacy) Mathcad, PTC’s Prime does not allow to scroll during the selection process to be able to select all matrix elements..

With larger matrices, it's usually practically impossible to expand them to full size, which is why copy and paste doesn't work in that case.

In your sheet M concists of 104 rows, but newM just of 25 ! So you obviously had not expanded M to full size before trying to copy it.

Expanding a matrix with just 104 rows to its full size is a hassle, but it's still definitely doable.
But if the matrix would consist of a few thousand or ten thousands or even more rows ...

21-Topaz II
August 6, 2026

Thanks Werner:

16-Pearl
August 6, 2026

Can you not just reassign the matrix to a new variable (B := A)?  Here I’m able to manipulate B and C but A remains unaltered. 

 

25-Diamond I
August 6, 2026

I also wondered what the reason for ‘unlinking’ the second matrix would be.

A scenario I often encountered in Mathcad 15 (and earlier versions) was that I had to import a large amount of data (e.g., a pixel image) from an external file, but then wanted to embed it in the Mathcad file so that the file would be self-contained and no longer require the external file.
An embedded Excel worksheet wasn’t an option, as it often caused problems (and still does in Prime as well).

Perhaps Snowshoeman has something similar in mind.

In MC15, you could import the data into a large matrix, copy the data to the clipboard (which isn’t possible in Prime for larger matrices), and then permanently embed it in the Mathcad worksheet using “Insert Data Table” and Ctrl-C.

There’s no alternative to “Insert Data Table” in Prime either. It was necessary to use it in legacy Mathcad because assigning a large matrix a variable would show the matrix in full size without an option to collapse it - a no-go in case of huge matrices.

In Prime this is better implemented and the matrix would show collapsed to about just 12 rows, so maybe its not a great miss that 'Insert-Data-Table' is not available in Prime.

Another reason why the lack of tables in the legacy Mathcad (not to be confused with the new tables in Prime) might be easy to tolerate is that creating and editing matrices in Prime is implemented much better.
On the other hand it’s a real shame, though, that copying data from matrices and scrolling through larger matrices have been implemented in such an unusable way.

 

13-Aquamarine
August 6, 2026

I thought that maybe one could run the first matrix through a function to create a second, unlinked matrix.

13-Aquamarine
August 6, 2026

Hello Werner.  I wanted to use the first column of the second matrix for programming purposes.  I would delete various rows and refill values in the second column of the second matrix for export to another program.

13-Aquamarine
August 6, 2026

That won’t work as B and C are still linked to A.  I want A to go away.

13-Aquamarine
August 6, 2026

The real text file I’m dealing with is 2100 rows long.  The copy/paste is not working for this.

25-Diamond I
August 6, 2026

That won’t work as B and C are still linked to A.  I want A to go away.

Exactly why?

If the goal is to manipulate/edit the matrix and then export it to a file to be used by another program, there would be no need to ‘unlink’ anything. The data you manipulate and edit in Mathcad does not affect the original data file in any way.

If the goal is to make the worksheet self-contained, working with the data in the text file without the need for the text file to be accessible, the only way I see doing this in Prime is to embed an Excel component with the data of the text file.

16-Pearl
August 6, 2026

Yes, I think they are after having a stand-alone file that doesn’t need to read from the original.  That wasn’t exactly clear.  That’s an interesting challenge.  I have an idea, but no time to play around with it.  If we change the extension to .zip and look through the files - in one of my examples it looks the result.xml file has all the read data in it.  So I’m thinking there is a way to assign that data to a variable inside the .xml file - if someone understands the file structure. 

13-Aquamarine
August 6, 2026

Thank you.  This is not a work stoppage.  Before I was creating the second matrix manually.  I was thinking I could develop a short cut.