DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DDE and Curve allocation

 
Post new topic   Reply to topic    DPlot Forum Index -> Suggestions/Questions
View previous topic :: View next topic  
Author Message
Code-Breaker



Joined: 30 Apr 2004
Posts: 12
Location: Tempe, AZ

PostPosted: Fri Jun 11, 2004 12:35 pm    Post subject: DDE and Curve allocation Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Fri Jun 11, 2004 12:52 pm    Post subject: Reply with quote

Quote:
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.

Quote:
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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Code-Breaker



Joined: 30 Apr 2004
Posts: 12
Location: Tempe, AZ

PostPosted: Tue Jun 22, 2004 12:06 pm    Post subject: Reply with quote

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.

Quote:
>> 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:

Quote:

/* $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,
Quote:

on return szArrays would be something like "2,1000" for maxc=2, maxp=1000.


Awesome! Thanks!
Back to top
View user's profile Send private message Visit poster's website
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Wed Jun 23, 2004 12:45 am    Post subject: Reply with quote

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

Code:
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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Suggestions/Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group