subset of varargin as function input
Afficher commentaires plus anciens
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:
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Argument Definitions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!