Cody

# Problem 2443. Clear functions with the same name in different packages independently

Solution 474290

Submitted on 17 Jul 2014 by Steven Van Vaerenbergh
• Size: 3
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% % Create necessary files mkdir +counter1 mkdir +counter2 fid = fopen('+counter1/count.m', 'w');fprintf(fid, 'function y=count,persistent x;if isempty(x), x=0; end,x=x+1;y=x;');fclose(fid); fid = fopen('+counter2/count.m', 'w');fprintf(fid, 'function y=count,persistent x;if isempty(x), x=0; end,x=x+1;y=x;');fclose(fid); rehash; % Start counting with Counter 1 counter1.count; %1 counter1.count; %2 counter1.count; %3 counter1.count; %4 counter1.count; %5 counter1.count; %6 counter1.count; %7 % Start counting with Counter 2 counter2.count; %1 counter2.count; %2 counter2.count; %3 counter2.count; %4 % Your code goes here your_code; % Check if your solution is correct %{ "I would prefer even to fail with honor than win by cheating." Sophocles %} % Restart counting with Counter 1 assert(isequal(counter1.count,1)) assert(isequal(counter1.count,2)) assert(isequal(counter1.count,3)) assert(isequal(counter1.count,4)) assert(isequal(counter1.count,5)) assert(isequal(counter1.count,6)) assert(isequal(counter1.count,7)) % Keep counting with Counter 2 assert(isequal(counter2.count,5))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!