How to fake an app handle in the arguments?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello.
I am working on a project which involves an app. What I do is to give the submethods a handle to the app, so that they can use the apps getter and setter methods, as well as the log file. This is done via Argument Validation, aka:
function [] = myFun(I, app, opt)
arguments
I (:, :) uint8 % the image
app (1, 1) eva
% Handle back to the app, to transfer data
opt.whatever1 (1, 1) {mustBeNumeric} = 100
opt.whatever2 (1, 1) {mustBeNumeric} = 100
opt.debug (1, 1) logical = false
end
% Function code
end
Now what I would like to do, is to be able to call the function like myFun(I, ?, 'debug', true), where I use the debug flag to not go into the parts of the code which actually uses the app handle. This would allow me to call the methods in the command line and not just from inside the app. In this case the '?' stands for whatever can be used. Empty strings or arrays do not work. Naively I'd use something like a Nullpointer, but I don't know if something like that exists in Matlab.
Any ideas or insights would be chuffing tremendous. Or if you know that this won't work as intended, that'd be good to know as well.
0 Commenti
Risposta accettata
dpb
il 5 Ott 2022
Use mustBeScalarOrEmpty validation function instead of fixed size would get past that hurdle. I've no klew whether it'll actually work as intended or not, I've never used any of the argument validation stuff...
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!