Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export to MATLAB #456

Closed
bhamadicharef opened this issue Aug 20, 2021 · 2 comments
Closed

Add export to MATLAB #456

bhamadicharef opened this issue Aug 20, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@bhamadicharef
Copy link

Based on the export to C, I think the MATLAB one should not be too hard.

@bhamadicharef bhamadicharef changed the title Add export to MATLABon the exa Add export to MATLAB Aug 20, 2021
@StrikerRUS StrikerRUS added the enhancement New feature or request label Aug 20, 2021
@muhammetbozkurt
Copy link

@bhamadicharef I am not sure this corresponds what you mean but you can use exported C model in matlab/simulink using coder.ceval.

  1. export c code and save it.
        code = m2c.export_to_c(estimator)
        with open("test.c", "w") as f:
        f.write(code) 
    
  2. create header file. Dont forget include header in test.c.
        //test.h
        #ifndef TEST_H
        #define TEST_H
        double score(double * input);
        #endif
    
  3. create .m file
    % test_m.m
    function y = test_m(in_data)
    
    coder.cinclude('test.h');
    y=0;
    y = coder.ceval('score', in_data); 
    end
    
  4. generate code but before it create a dummy input for matlab to understand its type.
    codegen test_m -args {dummy_data} test.c
    
  5. you can take inference using
    test_m_mex(in_data)
    

@StrikerRUS
Copy link
Member

Added into feature-request hub #490.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants