Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- READ FILE - RANGE OF ROWS AND COLUMNS

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

11-25-2021
09:32 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-25-2021
09:32 PM

READ FILE - RANGE OF ROWS AND COLUMNS

1 ACCEPTED SOLUTION

Accepted Solutions

11-26-2021
04:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-26-2021
04:19 AM

- "
**Example: Reading and Writing Data Files**": https://support.ptc.com/help/mathcad/r7.0/en/#page/PTC_Mathcad_Help%2Fexample_reading_and_writing_d... - "
**Example: Effect of ORIGIN on non-Lookup Functions**": https://support.ptc.com/help/mathcad/r7.0/en/#page/PTC_Mathcad_Help%2Fexample_effect_of_ORIGIN_on_o...

6 REPLIES 6

11-25-2021
11:01 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-25-2021
11:01 PM

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

Later in your file you write

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.

11-26-2021
09:41 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-26-2021
09:41 AM

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.

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.

11-26-2021
11:23 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-26-2021
11:23 AM

@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.

11-26-2021
04:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-26-2021
04:19 AM

- "
**Example: Reading and Writing Data Files**": https://support.ptc.com/help/mathcad/r7.0/en/#page/PTC_Mathcad_Help%2Fexample_reading_and_writing_d... - "
**Example: Effect of ORIGIN on non-Lookup Functions**": https://support.ptc.com/help/mathcad/r7.0/en/#page/PTC_Mathcad_Help%2Fexample_effect_of_ORIGIN_on_o...

11-28-2021
05:23 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-28-2021
05:23 PM

submatrix works for me.

11-27-2021
04:24 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2021
04:24 PM

@ppal wrote:

Question as per attached Prime 7

Thanks

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

First, some preliminary list processing function definitions:

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

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.

Implemented in Mathcad Express 7.

Stuart