0

Pre-edit: This bug disappeared for now but I don't know why, so I'd love an answer but don't bother as its a little bit of a waste of your time.

I am taking a list of names and if they don't already have a class I am generating one. (Just for snobs, I know feval isn't secure, but this is a tool for me alone.)

The problem is that each time I run the code it fails after the first new one, not on the fprintf but in the feval. If I just let it fail and then run it again it moves onto the next one, having successfully executed the one it previously failed on. At first I thought it might be a timing error, but it doesn't seem to be one, unless the delay is greater than 10 seconds. Any ideas?

edit: The error I get is Too many output arguments.

for i=1:len
    if ~exist([path,'\',obj.Values{i}],'file')
        next = fopen([path,'\',obj.Values{i},'.m'],'w');
        fprintf(next,...
            ['classdef ',obj.Values{i},'\n'...
            ,'    properties\n'...
            ,'        \n'...
            ,'    end\n'...
            ,'    methods\n'...
            ,'        function obj = ',obj.Values{i},'(gui)\n'...
            ,'            \n'...
            ,'        end\n'...
            ,'    end\n'...
            ,'end']);
        fclose(next);
    end
    obj.Children(obj.Values{i})= feval(obj.Values{i},obj);
end
2
  • Show the actual error you get, including all line numbers.
    – horchler
    Jun 1, 2015 at 22:39
  • @horchler I was just trying to recreate it and it seems to have gone away over night, which scares me. But I can't get the exact error. Sorry.
    – Hovestar
    Jun 2, 2015 at 14:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.