I've followed the advice in Matlab's documentation on implementing a custom copy method in some of my classes (overloading the copyElement method). However, it'd be nice to be able to display custom help for the modified method, in order to explain the additional functionality. Of course the matlab.mixin.Copyable.copy method is sealed, so cannot be overwritten. Anyone any ideas?
MATLAB: How do you overload the help of a built-in method
copyoop
Related Solutions
To overload the RAND function with your own function myrand.m, place myrand.m in a directory on the MATLAB path. Then, create the following function and save it as rand.m:
function varargout = rand(varargin)[varargout{1:nargout}] = myrand(varargin{:});
The built-in RAND function accepts both double and char inputs. Therefore, you will need this to save this file in a directory named @double and a directory named @char.
If the state of the new RAND is other than double datatype (e.g., uint32) you will have to create another copy of rand.m in another @<class> directory. Note that it is not recommended to have more than one @double directory on your search path, as this can create confusion on which @double folder is being used. Place all files overloaded for a specific data type <foo> within the same @<foo> directory.
The on-line documentation containing information about function overloading can be found at:
If you would like to use the Launch Pad in MATLAB 6.x and higher to find this information, follow this menu path:
MATLAB Help --> Using MATLAB --> Programming and Data Types --> MATLAB Classes and Objects --> Overloading Operators and Functions.
Alternatively, you could also search for "overloading" in the documentation by using the search tab in the Help Browser.
What John and Stephen said. What you appear to want (and wanted originally) is just
synthetic=conv(RC,amp);
which would be the convolution of RC and the amp kernel.
Prior to HG2 (handle graphics 2), graphics and other handles were just numeric values (doubles) so arithmetic operations on them were not illegal and so you didn't get an error in earlier release but the answer was nonsensical. Now, handles are a new class and so such erroneous operations can be flagged as errors.
You will want to revisit any calculations done earlier as they are in error; the result would have been just a constant times the vector.
R2012b>> h=plot(rand(4,1))h =174.0016>> whos hName Size Bytes Class Attributesh 1x1 8 double >> conv(h,1:4)ans =174.0016 348.0032 522.0048 696.0063>> [1:4]*hans =174.0016 348.0032 522.0048 696.0063>> R2014b>> h=plot(rand(3,1))>> hh = Line with properties: ...>> whos hName Size Bytes Class Attributesh 1x1 60 matlab.graphics.chart.primitive.Line >> >> double(h)ans = 1.2207e-04>>
So, you see that prior to HG2 plot returned a double that was a floating point value; the specific value is dependent upon each invocation, but 175+/- is typical. OTOH, with HG2 as R2014b shows, the handle is a class variable and you can't see the numeric value unless you cast it to double and you see the numeric value is grossly different.
Either, way, using the line handle in conv makes no sense computationally, whatsoever.
Best Answer