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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Creating a matrix by using "Text Box" control

VladimirN
24-Ruby II

Creating a matrix by using "Text Box" control

Hi,

I want to create the initial matrix by using a "Text Box" control. In an attachment you can find an example of creating a column vector. Is it possible to correct the program (using the separator character ";" [or may be other] for the rows) for creating matrix with "m*n" size?

Pic_1.png

ACCEPTED SOLUTION

Accepted Solutions

How about the attached? Note - you must end with a semi-colon.

Alan

mn.PNG

View solution in original post

17 REPLIES 17

How about the attached? Note - you must end with a semi-colon.

Alan

mn.PNG

Great, Alan! Thank you for your help!

Werner_E
25-Diamond I
(To:AlanStevens)

Here is a different approach, for whatever its worth.

Main difference is that every character is allowed and taken as data (apart from the separators space, comma and semicolon).

If str2num() would throw an error, the appropriate string is put in the matrix.

If there are elements missing in a row, they are filled with zeros at the end.

Werner,

Thank you for modifed program.

Is it possible to implement the transformation (from string into a function f(x)) of input function f(x) in the "Text Box" control field?

Pic_2.png

Werner_E
25-Diamond I
(To:VladimirN)

Getting the vector of ANSI codes from the input string (even if its assigned a function) is not that difficult

strvec.png

but creating a real function (your N() is a function which returns the same definition string for every argument) is sure not easy if possible at all.

Ther may be a feasible way of doing it using a scripted component while I don't know if we have access to expression from the script as we have to worksheet variables - I'm not well versed in scripting but maybe there is a way of creating a dummy function in the sheet rfirst, then the script can find that region and modofies the XML appropriately. In any case out of my reach. Doing it in pure Mathcad would require writing you own parser. This would be quite slow, I guess, and would be executed for every argument the function is called for - will slow down plotting significantly.

As a result, I would like to get the converted function, which can then be used in a symbolic calculation. Like this:

Pic_3.png

VladimirN. wrote:

Is it possible to implement the transformation (from string into a function f(x)) of input function f(x) in the "Text Box" control field?

Mathcad Server

http://twt.mpei.ac.ru/mas/worksheets/F_X_Y_Plot.mcd

Thank you, Valery.

VladimirN. wrote:

Thank you, Valery.

You welcome!

Use please the cloud function too:

Str2Vec.png

RichardJ
19-Tanzanite
(To:VladimirN)

Not quite, but maybe this will work, depending on exactly what it is you are trying to do.

Richard,

Thank you for your help. The solution you have provided is elegant. In an attachment, you can find another way of solution. But obviously it works in version M11, but not in M15. This example is taken from Valery site, which he pointed out. But as a result, I would like to get the converted function, which can then be used in a symbolic calculation. Like this:

Pic_3.png

RichardJ
19-Tanzanite
(To:VladimirN)

That's Tom's old expression compiler. Sorry, but it can't be made to work past version 11.

Because of the involved Maple symbolic engine?

RichardJ
19-Tanzanite
(To:VladimirN)

A number of worksheets and methods developed in version 11 used unsupported "features" of the software. When they went to version 12 they changed the symbolic processor, rewrote the compute engine, introduced SUC, etc. They changed a lot, and a lot of the unsupported features disappeared, either by choice (for example backdoor access to unsupported Maple functions, certain ways to use symbolics in programs), or by simple omission because they were unsupported. At the same time, a number of supported features also disappeared, either by design or by omission. A number of very useful worksheets no longer worked. Many of them still do not work in any later version, and proabaly never will. That's one of them.

In Prime:

Str2Equ.png

VladimirN. wrote:

Hi,

I want to create the initial matrix by using a "Text Box" control. In an attachment you can find an example of creating a column vector. Is it possible to correct the program (using the separator character ";" [or may be other] for the rows) for creating matrix with "m*n" size?

Mathcad Server

http://twtmas.mpei.ac.ru/mas/worksheets/lsolve.mcd

Announcements

Top Tags