Saturday, 15 March 2014

Implementing multiple syntaxes for a MATLAB plot function -



Implementing multiple syntaxes for a MATLAB plot function -

many of plotting functions in matlab , toolboxes (thought not all) allow both next syntaxes:

plotfcn(data1, data2, ...) plotfcn(axes_handle, data1, data2, ...)

the first plots current axes (gca) or creates , plots new axes if none exists. sec plots axes handle axes_handle.

having looked internals of several matlab , toolbox plotting functions, looks there isn't standardised way mathworks this. plotting routines utilize internal, open, function axescheck parse input arguments; simple check on first input argument; , utilize more complex input-parsing subfunction can handle larger variety of input syntaxes.

note axescheck appears utilize undocumented syntax of ishghandle - doc says ishghandle takes 1 input, returning true if handle graphics object; axescheck calls ishghandle(h, 'axes'), returns true if it's axes object.

is aware of best practice or standard implementing syntax? if not, way have found robust?

not sure understand question. separate plotting of info generation / setup of plots. if want plot histogram in standardized way have function called setup_histogram(some, params) homecoming appropriate handles. have function update_histogram(with, some, data, and, params) write info appropriate handles.

this works well, if have plot lots of info same way.

matlab

No comments:

Post a Comment