Using strcmp for Matlab mex file

I have the following code in a matlab script:

if(strcmp(data.task,'taskToDo')) AnalogOut(1, CurrentTime) end 

I want to integrate this code into a .cpp, which I already have, which is used to compile into a .mex file.

What would be an easy way to do this in .mex style?

Update

From Shai's answer , I realized that strcmp will work in a .cpp file. So I just need to change the code a bit to make it work:

 if (!strcmp(data.task,"taskToDo")) //here data.task is a const char * { AnalogOut(1, CurrentTime()); } 

Pretty simple.

+4
source share
1 answer

You can use the strcmp C strcmp to compare against null trailing lines.
Note that unlike Matlab C strcmp returns 0 when the strings match.

+1
source

Source: https://habr.com/ru/post/1486056/


All Articles