cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Translate the entire conversation x

Import values in Excel and Create a Table in Mathcad P10.

SFares
14-Alexandrite

Import values in Excel and Create a Table in Mathcad P10.

Hello All,

 

I have been manually inputting values from an Excel file into a table in Mathcad P10 sheet. I have attached both files. Is it possible to automate this process? I am interested in getting the values I highlighted in yellow in the excel sheet.

 

Regards,

Sam 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:SFares)

How about reading in each column via READEXCEL?

You have to be aware that the so called "tables" in Prime are meant for manual input of  data only, not for display of already existing data.

A Prime table actually just creates a collection of individual vectors.

In your Prime sheet you actually had defined 17 individual vectors.

 

Here as an example the creation of three of these 17 vectors using the data in the Excel sheet:

Werner_E_0-1756826817293.png

When we compare the vectors created that way with the ones you had manually input we see some discrepancies - in some places you did not use the exact Excel data in your manual input:

Werner_E_3-1756827845120.png

 

Guess it would also be possible to read in the whole sheet including the data you are not interested in an then use the thus created Prime matrix to extract the data needed.

Maybe something like

Werner_E_2-1756827684180.png

 

Prime 10 sheet attached

 

View solution in original post

9 REPLIES 9
Werner_E
25-Diamond I
(To:SFares)

How about reading in each column via READEXCEL?

You have to be aware that the so called "tables" in Prime are meant for manual input of  data only, not for display of already existing data.

A Prime table actually just creates a collection of individual vectors.

In your Prime sheet you actually had defined 17 individual vectors.

 

Here as an example the creation of three of these 17 vectors using the data in the Excel sheet:

Werner_E_0-1756826817293.png

When we compare the vectors created that way with the ones you had manually input we see some discrepancies - in some places you did not use the exact Excel data in your manual input:

Werner_E_3-1756827845120.png

 

Guess it would also be possible to read in the whole sheet including the data you are not interested in an then use the thus created Prime matrix to extract the data needed.

Maybe something like

Werner_E_2-1756827684180.png

 

Prime 10 sheet attached

 

SFares
14-Alexandrite
(To:Werner_E)

Hi Werner,

 

Last week, you and Stuart helped me with this reading each column via READEXCEL, as shown below. I just wanted to check if this process can be further automated.

SFares_1-1756828214850.png

 

 

Regards,

Sam

Werner_E
25-Diamond I
(To:SFares)

You may be able to use the "filterNaN" function to get rid of the rows containing an NaN.

 

But to get rid in, for example, in both of two vectors a and b of the lines where vector b contains a NaN, you have to first augment the vectors, then apply "filterNaN" and then separate the matrix again:

Werner_E_0-1756832673424.png

 

SFares
14-Alexandrite
(To:Werner_E)

Fantastic, Thank you so much, Werner!

SFares
14-Alexandrite
(To:Werner_E)

Hi Werner,

A question on the same sheet, instead of specifying the rows A10:A23, I know the first row is A10 but the last row can be any number of rows depending on the number of panels for a given design. Is there a way to make Mathcad read the number of rows in column A? For example if the rows in column A go up to TC8, i can use submatrix of the vector below and extract the values up to the last row needed.

SFares_2-1756836577180.png

SFares_1-1756836271053.png

 

Regards,

Sam

Werner_E
25-Diamond I
(To:SFares)

There is no way as far as I know to determine the number of rows in an Excel file before you read in the data.

I also think that there is no way to read in a complete column.

But you can read in the complete sheet as already shown.

So you could read the whole sheet, determine the number of rows and now you either can use READEXCEL once again for each column or, because the whole data is already read in Prime use the submatrix command to get the desired vector:

Werner_E_0-1756842880602.png

 

SFares
14-Alexandrite
(To:Werner_E)

Thank you so much, Werner!

StuartBruff
23-Emerald IV
(To:SFares)

One possibility is to use READEXCEL's default empty cell behaviour to fill such cells with NaNs.   Then, rather than read in each column, read in the whole range that encompasses your desired columns, and then filter out the rows with NaNs.

 

2025 09 02 A.png

 

2025 09 02 B.png

 

 

I find subcols (and its counterpart, subrows) to be generally useful (saves all that extra typing), although I usually use the following variants that allow indexing from the end, as well as the start, of a row or column.

 

2025 09 02 C.png

 

Stuart

SFares
14-Alexandrite
(To:StuartBruff)

Thank you so much, Stuart!

Announcements

Top Tags