DDE and Curve allocation

Have a suggestion for improving DPlot or a question about existing features? Let us know

Moderator: DPlotAdmin

Post Reply
Code-Breaker
Posts: 12
Joined: Fri Apr 30, 2004 2:03 pm
Location: Tempe, AZ
Contact:

DDE and Curve allocation

Post by Code-Breaker »

Hi David,

Is there a command to tell me how many curves are already allocated with dde?

For example, if I use filearrays to create 2 curves, and then I want to add a new curve at a later time, I would like to be able to obtain maxc (and maxp for that matter) so I can add to that number without having to keep track of it myself.

Also, I have not gotten dplotlib.dll working with Matlab. Any chance of including something like DPlot_AddData to the set of DDE commands?

Thanks alot -C-B
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Is there a command to tell me how many curves are already allocated with dde?

For example, if I use filearrays to create 2 curves, and then I want to add a new curve at a later time, I would like to be able to obtain maxc (and maxp for that matter) so I can add to that number without having to keep track of it myself.
No, there's not, but I can easily add one. Something like

char szArrays[64];
int dwSize = sizeof(szArrays);
retval = DPlot_Request(1,"ArraySize",szArrays,&dwSize);

on return szArrays would be something like "2,1000" for maxc=2, maxp=1000.
Also, I have not gotten dplotlib.dll working with Matlab. Any chance of including something like DPlot_AddData to the set of DDE commands?
Using DPlot_Command? No, no chance at all. DPlot_Command only takes a character string argument.

Edit: I realized after I clicked Submit that you aren't using DPlot_Command and must be using a Matlab gizmo that's roughly the equivalent of VB's LinkExecute. The same restriction would apply here, though.

What sort of problems do you have with dplotlib.dll? Matlab just refuses to work with it? A problem passing the address of your data? Or what?
Visualize Your Data
support@dplot.com
Code-Breaker
Posts: 12
Joined: Fri Apr 30, 2004 2:03 pm
Location: Tempe, AZ
Contact:

Post by Code-Breaker »

The problem I am experiencing with dplotlib.dll stems from my lack of knowledge. Matlab requires a header file for the dll, and I don't know what it is supposed to look like.
>> loadlibrary('c:\work\dplotlib.dll','c:\work\dplot.h')
Warning: The data type 'error' used by function DPlot_Command does not exist
...Here is an example of a 'good' header file, included with Matlab:
/* $Revision: 1.1 $ */
/*
* shrlibsample.h
*
* Copyright 2002 The MathWorks, Inc.
*/

#ifndef shrlibsample_h
#define shrlibsample_h

#ifndef EXPORT
#define EXPORT
#endif

typedef enum Enum1 {en1=1,en2,en4=4} TEnum1;

struct c_struct {
double p1;
short p2;
long p3;
};

/* Function declarations */
EXPORT void multDoubleArray(double *,int);

EXPORT double addMixedTypes(short,int,double);

EXPORT double addDoubleRef(double,double *,double);

EXPORT char* stringToUpper(char *);

EXPORT char* readEnum(TEnum1);

EXPORT double addStructFields(struct c_struct);

EXPORT double *multDoubleRef(double *x);

EXPORT double addStructByRef(struct c_struct *);

EXPORT void allocateStruct(struct c_struct**);

EXPORT void deallocateStruct(void *ptr);

EXPORT void multiplyShort(short *,int);

#endif
...and finally,
on return szArrays would be something like "2,1000" for maxc=2, maxp=1000.
Awesome! Thanks!
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Bearing in mind that I have absolutely no idea what I'm talking about :D, the C header file dplot.h is similar to what you need. Try:

Code: Select all

struct DPLOT {
   int Version;
   int hwnd;
   int DataFormat;
   int MaxCurves;
   int MaxPoints;
   int NumCurves;
   int Scale;
   float LegendX;
   float LegendY;
   int NP[100];
   int LineType[100];
   int SymbolType[100];
   int SizeofExtraInfo;
   char Legend[101][80];
   char Label[100][40];
   char Title[3][80];
   char XAxis[80];
   char YAxis[80];
};

EXPORT int DPlot_AddData(int,int,int,int,float *,float *);
EXPORT int DPlot_AddData8(int,int,int,int,double *,double *);
EXPORT int DPlot_Command(int,char *);
EXPORT int DPlot_Plot(DPLOT *,float *,float *,char *);
EXPORT int DPlot_Plot8(DPLOT *,double *,double *,char *);
EXPORT void DPlot_SetErrorMethod(int);
EXPORT int DPlot_Start(int, int *);
EXPORT void DPlot_Stop();
Not sure if the syntax is entirely correct, but since your example is very similar to C this is likely close. I'd suggest starting out trying DPlot_AddData or DPlot_AddData8 rather than DPlot_Plot. If you get that working then we can go from there.
Visualize Your Data
support@dplot.com
Post Reply