Adept Scientific - English
The world's best software and hardware for research, science and engineering.
flag arrow
clearclear

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKdedksvnofi
Home
Products
Training
Events
 Buy Online
Downloads
Academic Discounts
Support
My Adept
International |  About Us |  Adept Scientific Blog |  Contact Us |  Press Room |  Jobs
Adept Scientific on Facebook Adept Scientific on Twitter Adept Scientific on YouBube Adept Scientific on LinkedIn


The Next Steps

• Ask us a question
• Buy Mathcad Now
• View Mathcad Pricing
•  Download a Demo
•  Request a Brochure
• Download a Brochure
• Find out about Training
• Meet Our Team
• Read our RSS Feeds

Learn More

Mathcad Home
Mathcad Prime 2.0
Migration Guide

Version Comparison Chart
Mathcad Enterprise
Mathcad for Education
Rave Reviews
Add-ons

System Requirements

Latest Information

New Features in Mathcad
Prime 2.0

Mathcad Prime 2.0 movies
Using Mathcad and Excel
Return on Investment

Service & Support

Frequently Asked
Questions

Search the Knowledge
Base

Join the Discussion List
Search the List Archive

List Archives >  Mathcad List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[mathcad] resizing a matrix/vector

Search email archive for  

[mathcad] resizing a matrix/vector
Author: Tom Boni    Posted: Fri, 5 Sep 2008 12:10:31 -0700 (
What options are there for resizing a matrix/vector?

For instance lets say I have a 1 x 9 vector and want to make it 1 x 6 or 1 x 12?

Right now, I just create a new (empty) vector of the desired size...

Just thought I'd ask in case there is an "on-the-fly" method that I am not aware of...

In many cases the elements of the new vector are the same as elements in the existing vector...




---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to />

RE: [mathcad] resizing a matrix/vector
Author: Philip Oakley    Posted: Sat, 6 Sep 2008 12:36:01 +0100
Tom,

The hidden feature of MathCAD is that in reality it doesn't have any
variables. It has named constants that exist for a part of a page between
the point it is defined and the point that another of the same name is
defined.

The only 'unless' is that within a programme (with the black bar and the
left pointing arrows) those variables are true variables that can be
overwritten and are thrown away at the end of the execution.

So if you define
v:=stack(1,2,3,4,5,6,7,8,9)
then
v:submatrix(v,2,7,0,0)

you now have two variables 'v' (both vectors) on the page and if you type
"v=" and then drag it around, you will see the two results depending on
where the "v=" is on the page.

Also, if you have a set of indices 'index' to be used to pull out and
re-order it you can use. you can even convert it to a little programme if
needed.

i:=0;..last(index)
v[i]:=v[(index[i])]
will also do it (I have closed the [] brackets subscripts, shown :=, and the
range ;..

Hope that helps.
Philip

-----Original Message-----
From: Tom Boni /> Sent: 05 September 2008 8:11 PM
To: /> Subject: [mathcad] resizing a matrix/vector


What options are there for resizing a matrix/vector?

For instance lets say I have a 1 x 9 vector and want to make it 1 x 6 or 1 x
12?

Right now, I just create a new (empty) vector of the desired size...

Just thought I'd ask in case there is an "on-the-fly" method that I am not
aware of...

In many cases the elements of the new vector are the same as elements in the
existing vector...




---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to
/>
---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to

 Attachments:
 reorder a vector.mcd
 reorder a vector.xmcdz


Re: [mathcad] resizing a matrix/vector
Author: Radovan Omorjan    Posted: Sat, 06 Sep 2008 21:22:12 -0700
Look at the attached file (Mcad v.11)
For manipulating matrices you can use
submatrix - extracting a submatrix from a matrix
append - joining matrices horizontally (must have the same number of rows)
stack - joining matrices vertically (must have the same number of columns)

> What options are there for resizing a matrix/vector?
>
> For instance lets say I have a 1 x 9 vector and want to make it 1 x 6
or 1 x 12?
>
> Right now, I just create a new (empty) vector of the desired size...
>
> Just thought I'd ask in case there is an "on-the-fly" method that I
am not aware of...
>
> In many cases the elements of the new vector are the same as elements
in the existing vector...


---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to

 Attachments:
 rowmatrix.mcd


Re: [mathcad] resizing a matrix/vector
Author: =?ISO-8859-1?Q?Steen_Gro=F0e?=    Posted: Sat, 06 Sep 2008 13:33:11 +0200
> What options are there for resizing a matrix/vector?
>
> For instance lets say I have a 1 x 9 vector and want to make it 1 x
> 6 or 1 x 12?
>
> Right now, I just create a new (empty) vector of the desired
> size...
>
> Just thought I'd ask in case there is an "on-the-fly" method that I
> am not aware of...
>
> In many cases the elements of the new vector are the same as
> elements in the existing vector...

Sizing up is just adding the new elements.

Sizing down is slightly more difficult. You can use submatrix for that.

Med venlig hilsen

:-) Steen Grođe
http://www.grode.dk


---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to />

Re: [mathcad] resizing a matrix/vector
Author: David G Shaw    Posted: Sun, 07 Sep 2008 00:04:58 +0000
Hi Tom,



I have used the functions stack() and augment() from time to time.
stack(,,,,) adds elements, vectors or matrices to the vertical structure of a vector or matrix.
I use stack often to expand an arbitrary vector to get nice round numbers (2^N) for FFTs.

augment(,,,,) adds columns together to widen a matrix or lengthen a transposed vector.

Don't know the equivalent for reducing matrices. You can always delete rows or columns though.

Help shows:
"
Deleting RowsThis procedure deletes the row containing the selected element together with an appropriate number of rows below it. "


Hope these might help.

Regards,
David Shaw
-------------- Original message from Tom Boni --------------


> What options are there for resizing a matrix/vector?
>
> For instance lets say I have a 1 x 9 vector and want to make it 1 x 6 or 1 x 12?
>
> Right now, I just create a new (empty) vector of the desired size...
> Just thought I'd ask in case there is an "on-the-fly" method that I am not aware
> of...
> In many cases the elements of the new vector are the same as elements in the
> existing vector...
>
>
>
>
> ---
> The Mathcad List - Discussion, Support & News
> Contributions: /> > Hosted by: Adept Scientific http://www.adeptscience.com
> List Archive: http://lists.adeptscience.co.uk/
> ---
> Would you like this to come to a different email address?
> ---
> Simply leave the mailing list (see below) and re-join by
> sending a blank email from the new address to:
> or
> ---
> You are currently subscribed to mathcad as: unsubscribe send a blank email to
> /> ---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to

Re: [mathcad] resizing a matrix/vector
Author: Radovan Omorjan    Posted: Sat, 06 Sep 2008 21:27:22 -0700
Forgot to attach the file, sorry

> What options are there for resizing a matrix/vector?
>
> For instance lets say I have a 1 x 9 vector and want to make it 1 x 6
or 1 x 12?
>
> Right now, I just create a new (empty) vector of the desired size...
>
> Just thought I'd ask in case there is an "on-the-fly" method that I
am not aware of...
>
> In many cases the elements of the new vector are the same as elements
in the existing vector...


---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to

 Attachments:
 rowmatrix.mcd


RE: [mathcad] resizing a matrix/vector
Author: Stuart Bruff    Posted: Sat, 6 Sep 2008 15:51:56 +0100
Tom,

If you want to expand an array, simply set the values you want for the new
elements. A standard way of creating a vector is to set the largest index
to 0, which returns a vector of all zeros; for many applications this
improves execution speed as Mathcad only has to create the array once,
rather than having to keep bolting new elements on (which can be
time-consuming, particularly for large arrays).

To shrink an array, use the submatrix function, eg if v is your 9-element
vector, then submatrix(v,0,5,0,0) will return a 6-element vector comprising
the first six elements of v

Stuart

Calling convention: submatrix(vector,first_row,last_row,first_col,last_col)


-----Original Message-----
From: Tom Boni
Sent: 05 September 2008 8:11 PM
To: /> Subject: [mathcad] resizing a matrix/vector


What options are there for resizing a matrix/vector?

For instance lets say I have a 1 x 9 vector and want to make it 1 x 6 or 1 x
12?

Right now, I just create a new (empty) vector of the desired size...

Just thought I'd ask in case there is an "on-the-fly" method that I am not
aware of...

In many cases the elements of the new vector are the same as elements in the
existing vector...




---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by sending a blank
email from the new address to: or
---
You are currently subscribed to mathcad as:
To unsubscribe send a blank email to
/>
--
This message has been scanned for viruses and
dangerous content by Houxou, and is
believed to be clean.



---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to

 Attachments:
 collab - matrix expansion 01.mcd


Re: [mathcad] resizing a matrix/vector
Author: Tom Boni    Posted: Mon, 8 Sep 2008 15:11:52 -0700 (
This is a technique that I will have use for.

Thanks!



--- On Sun, 9/7/08, Radovan Omorjan wrote:

> From: Radovan Omorjan /> > Subject: Re: [mathcad] resizing a matrix/vector
> To: /> > Date: Sunday, September 7, 2008, 8:27 AM
> Forgot to attach the file, sorry
>
> > What options are there for resizing a matrix/vector?
> >
> > For instance lets say I have a 1 x 9 vector and want
> to make it 1 x 6
> or 1 x 12?
> >
> > Right now, I just create a new (empty) vector of the
> desired size...
> >
> > Just thought I'd ask in case there is an
> "on-the-fly" method that I
> am not aware of...
> >
> > In many cases the elements of the new vector are the
> same as elements
> in the existing vector...
>
>
> ---
> The Mathcad List - Discussion, Support & News
> Contributions: /> > Hosted by: Adept Scientific
> http://www.adeptscience.com
> List Archive: http://lists.adeptscience.co.uk/
> ---
> Would you like this to come to a different email address?
> ---
> Simply leave the mailing list (see below) and re-join by
> sending a blank email from the new address to:
> or
> ---
> You are currently subscribed to mathcad as:
> /> > To unsubscribe send a blank email to
> />



---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to />

RE: [mathcad] resizing a matrix/vector
Author: Tom Boni    Posted: Mon, 8 Sep 2008 15:21:18 -0700 (
Philip,

I think I understand your point.

Isn't this why one needs to be sure that they haven't accidentally redefined their "variables" during the course of a calculation (?)

Although, couldn't one argue that the x in F(x) is a "true" variable?

Thanks again...

--- On Sat, 9/6/08, Philip Oakley wrote:

> From: Philip Oakley /> > Subject: RE: [mathcad] resizing a matrix/vector
> To: /> > Date: Saturday, September 6, 2008, 3:36 PM
> Tom,
>
> The hidden feature of MathCAD is that in reality it
> doesn't have any
> variables. It has named constants that exist for a part of
> a page between
> the point it is defined and the point that another of the
> same name is
> defined.
>
> The only 'unless' is that within a programme (with
> the black bar and the
> left pointing arrows) those variables are true variables
> that can be
> overwritten and are thrown away at the end of the
> execution.
>
> So if you define
> v:=stack(1,2,3,4,5,6,7,8,9)
> then
> v:submatrix(v,2,7,0,0)
>
> you now have two variables 'v' (both vectors) on
> the page and if you type
> "v=" and then drag it around, you will see the
> two results depending on
> where the "v=" is on the page.
>
> Also, if you have a set of indices 'index' to be
> used to pull out and
> re-order it you can use. you can even convert it to a
> little programme if
> needed.
>
> i:=0;..last(index)
> v[i]:=v[(index[i])]
> will also do it (I have closed the [] brackets subscripts,
> shown :=, and the
> range ;..
>
> Hope that helps.
> Philip
>
> -----Original Message-----
> From: Tom Boni /> > Sent: 05 September 2008 8:11 PM
> To: /> > Subject: [mathcad] resizing a matrix/vector
>
>
> What options are there for resizing a matrix/vector?
>
> For instance lets say I have a 1 x 9 vector and want to
> make it 1 x 6 or 1 x
> 12?
>
> Right now, I just create a new (empty) vector of the
> desired size...
>
> Just thought I'd ask in case there is an
> "on-the-fly" method that I am not
> aware of...
>
> In many cases the elements of the new vector are the same
> as elements in the
> existing vector...
>
>
>
>
> ---
> The Mathcad List - Discussion, Support & News
> Contributions: /> > Hosted by: Adept Scientific
> http://www.adeptscience.com
> List Archive: http://lists.adeptscience.co.uk/
> ---
> Would you like this to come to a different email address?
> ---
> Simply leave the mailing list (see below) and re-join by
> sending a blank email from the new address to:
> or
> ---
> You are currently subscribed to mathcad as:
> /> > To unsubscribe send a blank email to
> /> >
> ---
> The Mathcad List - Discussion, Support & News
> Contributions: /> > Hosted by: Adept Scientific
> http://www.adeptscience.com
> List Archive: http://lists.adeptscience.co.uk/
> ---
> Would you like this to come to a different email address?
> ---
> Simply leave the mailing list (see below) and re-join by
> sending a blank email from the new address to:
> or
> ---
> You are currently subscribed to mathcad as:
> /> > To unsubscribe send a blank email to
> />



---
The Mathcad List - Discussion, Support & News
Contributions: /> Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
You are currently subscribed to mathcad as: /> To unsubscribe send a blank email to />

Previous by date: Re: [mathcad] Contouring irregular data,  Tom Gutman
Next by date: [mathcad] getting plot data, Tom Boni
Previous thread: [mathcad] Contouring irregular data, Rob Beale
Next thread: [mathcad] getting plot data, Tom Boni



Ready to buy?

Mathcad Prime
Add to shopping basket
£ 970.00
Upgrade to Mathcad Prime from v14
Add to shopping basket
£ 220.00
Upgrade to Mathcad Prime from v11, v12, v13
Add to shopping basket
£ 290.00

Featured Downloads

Mathcad Prime 2.0 Brochure
Mathcad Prime 2.0 Installation and Usage Information
Mathcad Prime 2.0 Installation and Administration Guide
Mathcad Prime 2.0 Keyboard Shortcuts
Mathcad Prime 2.0 Migration Guide
Mathcad Prime 2.0 FAQs

Latest Downloads

Mathcad Prime 2.0 - 64 Bit Demo
Mathcad Prime 2.0 - 32 Bit Demo
Mathcad Prime 2.0 Installation and Usage Information
Mathcad Version Comparison Chart
Application Example: Faster Physical Modelling for Mathcad users

Latest News

"I've been using Mathcad since 1995 and I really love using it because it is the most optimal engineering tool.
“Greater flexibility, ease of use, an intuitive layout,...
“Every engineer and mathematics-oriented professional should consider...
“If you are looking to save engineering hours by standardising your company reports with clearly defined calculations and professional formatting,
PTC adds powerful new capabilities to Mathcad
adept

Top of the Page

Popular Links: ChemDraw | ChemOffice | Data Acquisition | Data Analysis | EndNote | Maple | MapleSim | Mathcad | MathType | Quality Analyst | Reference Manager | VisSim

EU ePrivacy Directive | Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2012, Adept Scientific plc.
Site designed and maintained by Lyndon Ash

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055