سؤال

I've a problem with the activex owc11.Spreadsheet.11.

In my Matlab script I declare the activex with:

CONTROL='OWC11.SPREADSHEET.11';
positions=[10,10,10,10];
handles.activex1=actxcontrol(CONTROL,[positions], myFigHandle);

I'd like to control some events like 'SheetChange' and 'EndEdit', associating these to subfunctions (@subfunctionSheetChange, @subfunctionEndEdit).

I tried to use this code:

handles.activex1.registerevents({'SheetChange', '@subfunctionSheetChange'});
handles.activex1.registerevents({'EndEdit', '@subfunctionEndEdit'});

..but I only reach this reasult:

???Error using ==> comeventcallback (at line....) Error firing event 'SheetChange' to MainFunction(@subfunctionSheetChange)

How can I resolve ? Please help me

هل كانت مفيدة؟

المحلول

From the docs:

The eventhandler argument can be either a string that specifies the name of the event handler function, or a function handle that maps to that function.

You seem to have mixed up function-handle and function-name into string that is neither of the two. You should be able to either use function-handles:

% function-handles - not strings:
handles.activex1.registerevents({'SheetChange', @subfunctionSheetChange});
handles.activex1.registerevents({'EndEdit', @subfunctionEndEdit});

or function-names:

% mind: no "@"-prefix
handles.activex1.registerevents({'SheetChange', 'subfunctionSheetChange'});
handles.activex1.registerevents({'EndEdit', 'subfunctionEndEdit'});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top