cancel
Showing results for 
Search instead for 
Did you mean: 
Security Alert Log4j Security Vulnerability. Click here to know more.
cancel
Showing results for 
Search instead for 
Did you mean: 

READ FILE - RANGE OF ROWS AND COLUMNS

ppal
14-Alexandrite

READ FILE - RANGE OF ROWS AND COLUMNS

Question as per attached Prime 7

Thanks

muser_0-1637893792976.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
VladimirN
23-Emerald IV
(To:ppal)
6 REPLIES 6
Werner_E
24-Ruby IV
(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
14-Alexandrite
(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 IV
(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.

VladimirN
23-Emerald IV
(To:ppal)
ppal
14-Alexandrite
(To:VladimirN)

submatrix works for me.

StuartBruff
23-Emerald I
(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

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."