[Scilab-users] API Error

shamikam shamika.i.nair at gmail.com
Thu Oct 6 08:55:57 CEST 2016


This is the entire callOct function for now.

extern "C"{
#include "api_scilab.h"
#include "Scierror.h"
#include "sciprint.h"
int
callOct(char *fname, unsigned long fname_len)
{                
    SciErr sciErr;
    int iRows       = 0;
    int iCols       = 0;
    int *piAddrChild    = NULL;
    double* listItem =NULL;
    int a=0;               
                    sciErr = getVarAddressFromPosition(pvApiCtx, 1,
&piAddrChild);
                    if(sciErr.iErr)   
                    {
                        printError(&sciErr, 0);
                        return 0;
                    }                 

                    int noItemList   = 0;                    
                    sciErr = getListItemNumber(pvApiCtx, piAddrChild,
&noItemList);
                    
                    if(sciErr.iErr)
                    {
                        printError(&sciErr, 0);
                        sciprint("This variable is not a list");
                        return 0;
                    }
                    sciprint("%d",noItemList);
                    
                    for( a= 1 ;a<=noItemList ; a++)
                    {                           
                        sciErr = getMatrixOfDoubleInList(pvApiCtx,
piAddrChild, a, &iRows, &iCols, &listItem);                        
                        if(sciErr.iErr)
                        {
                            printError(&sciErr, 0);
                            return 0;
                        }
                    }
// Perform further calculations.
}
}

I called callOct-
-->c=hypermat([2 3 2 2],1:24);
 
-->callOct(c) 
I get the same error as mentioned in the first post. The variable browser
says c is hm(Mlist). On Scilab console, for type(c), the answer is 17.
According to this- https://help.scilab.org/docs/5.5.2/en_US/sci_types.html,
17 is mlist. 

I tried to get the number of items(matrices) in the mlist. It did not
generate the correct number. When I called the function with a list, there
were no errors. It did generate the right number of list items.

I need the code to work for 3D and higher dimension matrices. Why doesn't
the list API functions work for mlist variables? How do I access 3D matrices
in c/c++ code?






--
View this message in context: http://mailinglists.scilab.org/Scilab-users-API-Error-tp4034704p4034715.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list