CLIPS-C and CLIPS - .CSV

Help
slim
2013-05-31
2013-06-02
  • slim
    slim
    2013-05-31

    Hello everybody,

    I have a C function called "amortiss.c" and I want it to communicate with CLIPS (Expert System Tool).Infact, I want to pass the variable "result" returned by this function "amortiss.c" to CLIPS so that it compares it to 1 and then displays messages depending on the comparaison.
    According to the Clips user guide I should define an external function called user-defined function.c. So I am thinking of putting this "result" in an Excel (.CSV file) and then the user defined function reads the "result" values from this .CSV file.
    In bref,the .CSV file extracts the "result" from the "amortiss.c" function and then the "user defined.c" function reads it. is there any way to do this? I am really confused. All your suggestion and help will be appreciated.
    Thanks.

     
  • Gary Riley
    Gary Riley
    2013-06-01

    Unless the C function in the amortiss.c file is run as part of a separate program, you don't want to use a file to transfer data. Instead write a user-defined function that calls the C function in amortiss.c and return that result from the user-defined function.

     
  • slim
    slim
    2013-06-02

    Thank you for responding.
    Question 1/ Infact, the "amortiss.c" is a part of a seperate program;It is a mex- function connected to matlab, but written in C. It calculates the quotient of two input numbers (x,y) than it transfers the output result (z) to Matlab workspace in order to get a plot of the output (z). At the same time, I want it to transfer the inputs (x,y) to an Excel file (a .CSV file) read by the CLIPS user function. Clips user function is going to calculate the output (z) and then compares it to 1; If (z ==1 then printout t "message1" crlf ); if (z < 1 then printout t "message2" crlf).. This is an idea of what I want to do.So any suggestion, please ?

    Question 2/ I wanted to execute the User-define function example written in section 3.4 of the CLIPS Reference Manual but I did not understand steps 5, 6 and 7 (compile and link all object code files and execute new CLIPS executable) knowing that I have a CLIPSWIN.exe and CLIPSDOS.exe . I would like to have further explanation about this. Concerning steps 1, 2, 3 and 4, I should have in whole 3 files:
    Construct.clp
    Userfunction.c
    *** Myfunction.c (which is called in the example TripleNumber)
    is my understanding correct?

    Thank you so much for all your help and advice. I do appreciate.