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
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
Solved! Go to Solution.
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:
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:
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
Prime 10 sheet attached
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:
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:
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
Prime 10 sheet attached
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.
Regards,
Sam
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:
Fantastic, Thank you so much, Werner!
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.
Regards,
Sam
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:
Thank you so much, Werner!
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.
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.
Stuart
Thank you so much, Stuart!