[Scilab-users] Struct and Cell Array API function

François Granade francois.granade at scilab-enterprises.com
Wed Oct 28 19:17:39 CET 2015


Hi Shamika,

There is currently no API to access struct (nor cells); it *is* possible, but not easy; and it would require a little bit of code. Here are the possibilities to access structs/cells:
- either use the fact that structs are overloaded mlists: thus you can access them as mlist, and extract/create your data by hand in C++ (that's where some code is needed... we could show you that if needed)
- or, easier, do the struct <-> mlist conversion on the Scilab side, not on C++ side. That way you only manipulate mlists on the C++ side. Or, for that matter, convert them, on the Scilab side, in/from another format easily managed on the C++ side.
- now, maybe it's worth looking at Scilab 6, where there are native types "types::struct" and "types::cell" directly in the api_scilab API... which makes things much easier. But the API is not documented (yet).

We can talk more about it if you need; the right solution may depend of your the exact use case (in terms of performance in particular). Also we strongly suggest that you start looking at Scilab 6 for that; if we have done things right, everything should be easier there :). We can help you on that too...

Regards,

François



On Oct 26, 2015, at 2:39 PM, Shamika Mohanan <shamika.i.nair at gmail.com> wrote:

> Hi,
> 
> I posted this query on Scilab developer's mailing list but I got no reply. I'm trying my luck here. 
> 
> I'm using Scilab API in C++ code. I have to return struct and cell array values to Scilab environment. As there are no Scilab API functions for struct and cell array data types, is there any way to do it? If I do have to write API functions, would list/mlist be the best way to deal with structs and cell arrays?
> 
> Shamika
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20151028/224b74d7/attachment.htm>


More information about the users mailing list