Re: understanding data types
- From: "Roger " <rwbta@xxxxxxxxxxx>
- Date: Sun, 1 Feb 2009 15:53:01 +0000 (UTC)
dpb,
Thanks for taking the time to answer my questions. There were quite a few of them ;) I will diligently work thru all the info you provided.
dpb <none@xxxxxxx> wrote in message <gm1sac$ps9$1@xxxxxxxx>...
Roger wrote:.
I am a not a MatLab user. I am trying make use of a client's dll that
was created with Builder NE. I use MS Visual Studio 2008. I have read
a lot in MatLab's documentation but am still at a loss to understand
what data types are supported by MatLab and its arrays.
Coming from C, C++, C#, and VB background, I am accustomed to seeing
variables declared with their data types. It seems that MatLab
variables are simply typed in with no explanation of what are their
data types, how they are to be used, how many dimensions they
contain, or anything else that might be used by other programmers
working on a project. Forgive me if I am mistaken, but it is rather
puzzling to me.
Is there a way to determine such information about an array? (Other
than meticulouosly examining the previous programmer's spaghetti code
which hasn't helped so far).
I am trying to store data from SQL Server tables into a MatLab array
and have been quite unsuccesful. What data types can be stored in
MatLab arrays? Can arrays store datetime values? If so, do they store
down to the millisecond range? Can arrays store boolean or string
data? Is it possible to store more than one kind of data type? For
example, can I store a datetime value in one column, a boolean value
in a second column, an integer in a third column, a double in fourth?
If so, how is that done? Are there explanation in the documention on
how to do this? I've had no luck finding it thru the search feature?
I am not working in MatLab. I am trying to work with the dll it
created. So I will not be changing any m-code. Can anybody help?
Not really other than some generalities...I hadn't heard of "Builder NE"
so went to look...it's yet another layer of abstraction on top of the
previous abstraction of Matlab data types which are an abstraction of
the language to provide the rapid development environment... :)
IOW, you picked about the most complicated direction from which to
approach it as possible it would seem... :(
The general answer to the questions (but I have no specific answers;
only a couple of links into the NE documentation I looked at that seem
kinda' a starting point plus another one into the ML doc's)...
ML does, indeed, not have a typing naming mechanism as you've noted.
This is both its advantage and its weakness--it provides the rapid
development of not having to worry over stuff like that when writing
code as any variable will be created and allocated automagically at run
time. Of course, it also means any new variable that's a typo gets
created silently as well instead of raising a more explicit error that
some compiled languages might.
AFAIK there's not a method outside ML environment to discern the type of
a variable -- inside ML the "whos" command does provide a list of all
variables in the active workspace by name and includes storage and the
class of the variable. Once the code has been converted to the DLL by
the compiler, I don't know of any tool to tell--the overhead to handle
each type correctly has been built into the code, of course, but that's
not easily viewable and I don't know a technique to retrieve it.
> What data types can be stored in MatLab arrays?
Any. Default is a Double; there classes for Single, various integers,
complex and string data. Some of the classes outside Double aren't
fully supported for all numeric operations, etc., but they can be
stored/represented.
> Can arrays store datetime values? If so, do they store
> down to the millisecond range?
Yes; how depends on the representation chose. The MS convention of a
Double w/ the integer portion representing a Julian date and the
fractional portion the fractional portion of the hours is easily supported.
> Can arrays store boolean or string
> data? Is it possible to store more than one kind of data type? For
> example, can I store a datetime value in one column, a boolean value
> in a second column, an integer in a third column, a double in fourth?
> If so, how is that done? Are there explanation in the documention on
> how to do this? I've had no luck finding it thru the search feature?
Yes; yes; and yes... :)
It would be a cell array--however, it appears from the quick perusal I
made that cell arrays may not be (directly anyway) supported by the NE
product. There you'd have to dig into that a little more to see what
is/isn't allowed. ML itself can do all the above, however.
It would seem if it were possible, one thing that might help would be to
have the developer of the DLL have the whos command operate on the ML
functions and supply that information as part of his documentation. I
agree it's not the easiest to read somebody else's code, particularly if
not familiar w/ ML and they didn't do a very good job of commenting or
even writing the code to figure out what each variable type and
dimensions is.
To start w/ a description of ML data types, read the section
Classes (Data Types) under the Programming Fundamentals chapter in the
online documentation.
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab.html
is the top level link; follow expand the contents in the left pane to
drill down.
--
- Follow-Ups:
- Re: understanding data types
- From: dpb
- Re: understanding data types
- Prev by Date: Three different colors for 3 curves on a plot
- Next by Date: plotting something against time
- Previous by thread: Three different colors for 3 curves on a plot
- Next by thread: Re: understanding data types
- Index(es):
Relevant Pages
|
Loading