subset of varargin as function input
Mostrar comentarios más antiguos
I call a function in the main code
plotFT( var1,var2,...,var13)
whose input variable can be either 10 or 13. The function in subject is defined as follows:
function plotFT( varargin )
switch nargin
case 10
fun1( varargin{1:10} ) %why doesn't work just with varargin as input?
case 13
subplot(1,2,1)
fun1( varargin{1:10} )
subplot(1,2,2)
fun2( [ varargin{1:3} varargin{11:13} ] ); %I can't't catch the mistake
otherwise
warning('Unexpected number of inputs')
end
fun1 works but for fun2 the followinf error message is prompted: "Error using horzcat. The following error occurred converting from char to struct: Conversion to struct from char is not possible." Questin1:
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Argument Definitions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!