how a built-in matlab/octave function can be called from a GTK+2 C code. i know how to call octave functions from C code by Mex files, but i don't know how i can call matlab/octave function from GTK+2 C code. is it possible to use Mex files to call matlab/octave function from a GTK+2 C code. suppose i want to make GUI using GTK+2 C code to display result of addition of two numbers using a matlab/octave function. i have searched on Internet but was not to find what i am looking for. i am not sure if i try to compile it from the matlab/octave how the flags required for GTK+2 will be added
i am posting this code can you please tell me how to compile it without error
when i try to compile it using mkoctfile --mex addition_GUI.c
error occurs addition_GUI.c:1:20: fatal error: gtk/gtk.h: No such file or directory compilation terminated.
here is the code
#include<gtk/gtk.h>
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
mxArray *in[2], *out[1];
in[0] = mxCreateDoubleScalar(1);
in[1] = mxCreateDoubleScalar(2);
mexCallMATLAB(1, out, 2, in, "addition");
mexCallMATLAB(0, NULL, 1, out, "disp");
mxDestroyArray(in[0]);
mxDestroyArray(in[1]);
mxDestroyArray(out[0]);
}
void static call(GtkWidget *widget,gpointer data)
{
g_print("\n%s\n",gtk_entry_get_text(GTK_ENTRY(data)));
gint a=3;
gint b=2;
gint x;
x=a+b;
char y[4];
sprintf(y, "%d", x);
gtk_entry_set_text(GTK_ENTRY(data),y);
}
int main(int agrc, char *agrv[])
{
gtk_init(&agrc,&agrv);
GtkWidget *entry,*window,*button,*hbox;
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window,"delete-event",G_CALLBACK(gtk_main_quit),NULL);
hbox=gtk_hbox_new(0,0);
gtk_container_add(GTK_CONTAINER(window),hbox);
button=gtk_button_new_with_mnemonic("ADD");
entry=gtk_entry_new();
const char* sum="3+2";
gtk_entry_set_text(GTK_ENTRY(entry),sum);
g_signal_connect(button,"clicked",G_CALLBACK(call),entry);
g_signal_connect(entry,"activate",G_CALLBACK(call),entry);
gtk_box_pack_start(GTK_BOX(hbox),button,0,0,0);
gtk_box_pack_start(GTK_BOX(hbox),entry,0,0,0);
gtk_widget_show_all(window);
gtk_main();
return 0;
}