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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

MathcadAllocate

ptc-4441233
1-Newbie

MathcadAllocate

Hi Community,

I need a little help with the MathcadAllocate Command, what I understood so far is that I am able to allocate with this command a certain amount of memory, still I do not know for what I am allocating this memory, means how to explain the code that I want to allocate the Memory for my output COMPLEXSCALAR, I really dont get it and the help is not quite usefull on that topic, my search in the forum so far didn't help either.

Would be nice if you have some sample function where I can see how to allocate the memory correct.

Thanks in advance,

David

1 ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:ptc-4441233)

Hi David,

you do not need to allocate memory for a scalar, net even if it's complex. The only (allowed output) structures that you need to allocate memory for are strings (using MathcadAllocate) and arrays (vectors and matrices of complex scalars, using MathcadArrayAllocate).

For more information consult the provided examples (in the UserEFI directory) of 'cmplxsum' (which contains a function producing a complex scalar and does not use a memory allocator) and 'simple' (which contains a function that multiplies an array with a scalar, producing an array and therefore uses MathcadArrayAllocate).

Success!

Luc

View solution in original post

7 REPLIES 7

Hello!

Look in the Mathcad Help: "Developer's Reference":

Pic.png

Pic_1.png

Also, maybe this will helps you: "Mathcad User Guide - Creating a User DLL".

Hi Vladimir,

Thanks allot for the help, but sadly thats what I already have found myself, but it is still a bit unclear to me, as the help leaves out the syntax and is completely missing an example.

The MathcadArrayAllocate command owns his own syntax, so I tell the programm allocate memory for a certain array (taken out of the developers reference):

BOOL MathcadArrayAllocate(array, rows, cols, allocateReal,

allocateImaginary)

COMPLEXARRAY* const array;

unsigned int rows;

unsigned int cols;

BOOL allocateReal;

BOOL allocateImaginary;

So if I want to do the same for a ComplexScalar, means I will have to use the Mathcadallocate command, but how do I define to allocate the memory for my output variable, for example OUTPUT1? When I try to do this in a classical c scheme, somehting like that:

double *line;

line = malloc(sizeof(double));

Is there a similar procedure for MathcadAllocate, or did I understand that completely wrong? Means I do not allocate the memory for a certain variable, I do it for the whole output?

Thanks in Advance for any replies, every help is welcome.

Regards

David

David,

Do you have an active maintenance for Mathcad? If yes, then create a new "Сase" with your question to PTC's technical support, here: "Log a New Case"

PhilipOakley
5-Regular Member
(To:ptc-4441233)

the examples are located in C:\Program Files\Mathcad\Mathcad 15\userefi\microsft\sources\ .... \*.c

I have posted some examples somewhere here / old collab.

IIRC they may have missed one of the lib files from the release but google is your friend...

LucMeekes
23-Emerald III
(To:ptc-4441233)

Hi David,

you do not need to allocate memory for a scalar, net even if it's complex. The only (allowed output) structures that you need to allocate memory for are strings (using MathcadAllocate) and arrays (vectors and matrices of complex scalars, using MathcadArrayAllocate).

For more information consult the provided examples (in the UserEFI directory) of 'cmplxsum' (which contains a function producing a complex scalar and does not use a memory allocator) and 'simple' (which contains a function that multiplies an array with a scalar, producing an array and therefore uses MathcadArrayAllocate).

Success!

Luc

He Guys,

Thanks for your quick replies, the information Luc gave me was exactlty what I was looking for, the little piece of information I have been missing.

Thanks allot to all of you!

Have a nice weekend!

David

I'm glad that you solve your problem.

Top Tags