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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

READ FILE - RANGE OF ROWS AND COLUMNS

ppal
17-Peridot

READ FILE - RANGE OF ROWS AND COLUMNS

Question as per attached Prime 7

Thanks

muser_0-1637893792976.png

 

1 ACCEPTED SOLUTION
6 REPLIES 6
Werner_E
24-Ruby V
(To:ppal)

Does it mean that Tom, 1,2 etc. are in the first column of your read-in data and Alan, 5, 6 in the second?

Are the numbers numerical data or are the read in as text?

Can you rule out that something like "6, Jone" or "Tom, 5" occurs? That means, a row either contains numerical data only or text only.

You write that you have a lot of columns and your example seems to show only 2. What if you have 30 or more columns - do you really want each numerical column data in its own variable (I, J ,.....??)? Wouldn't it suffice to simply delete all not numerical data and returned the cleaned matrix?

 

Guess it would be helpful if you can provide an example of a read-in matrix and the desired output.

 

Here is a first suggestion

Werner_E_0-1637900168560.png

 

 

Later in your file you write

Werner_E_0-1637899423028.png

I have no idea what you really want with this. Are you looking for a command like "submatrix" ?

 

I skipped the rest of your file and if the regions there have nothing to do with your question, you should delete them before posting the file.

 

ppal
17-Peridot
(To:Werner_E)

Well you could replicate the two columns to 2000 columns if it helps.

The numerical values start and stop in the rows as shown.

The structure is right.


The text rows remain text and numerical rows remain numbers.

You will not get numbers where there is text and vice versa.
Werner_E
24-Ruby V
(To:ppal)


@ppal wrote:
Well you could replicate the two columns to 2000 columns if it helps.

The question was if you really insist on the result being 2000 separate variables as you example shows (I, J,....) in that case 😉
A matrix consisting of just the rows with numerical values seem more appropriate, especially when you have many columns.

 

Given from the rest you wrote I guess that I already provided a solution (the expression which starts with "trim").

If you expected a different result, you would have to explain in more detail what you would like the result to look like.

ppal
17-Peridot
(To:VladimirN)

submatrix works for me.

StuartBruff
23-Emerald II
(To:ppal)


@ppal wrote:

Question as per attached Prime 7

Thanks

muser_0-1637893792976.png

 


For those with Mathcad Express, here's one possible functional version.

 

First, some preliminary list processing function definitions:

 

2021 11 27 a.png

 

Then the definition of the filter function and its application to the test data.  This version uses the function stkdn to ensure that :

 

2021 11 27 b.png

 

And, finally, a slightly different implementation of filter that removes w's initial value at the end of filtering.  It has the disadvantage that v must be a single-column array.

 

2021 11 27 c.png

 

Implemented in Mathcad Express 7.

 

Stuart

Top Tags