Wednesday, March 24, 2010

recursive action into folders

I wanted to do mcc to all the files inside the folder... you know automate it.
This one does it!



clear all
clc
% Read directory names
dirLIST = dir

% get number of directories
N = length(dirLIST)

% Loop through the directories
% Skip the first two..
for n = 3:N

 
    thisDIR = dirLIST(n).name;


        cd(thisDIR);
         disp(['Working on ' thisDIR]);
        mcc -m run_me_deAR.m

        pwd

     
 cd('..');


end

Monday, March 22, 2010

automated mcc to list of files (fail!)

this did not work
:(



clear all
clc
% Read directory names
LISTitems = dir;

% get number of directories
N = length(LISTitems);

% Loop through the directories
% Skip the first two..
for n = 3:N

  
   doTHIS= LISTitems(n).name
 
   mcc -m doTHIS % does not work!
    pause
  

end
% cd('..');
% pwd
   

Saturday, March 20, 2010

automated direcotry listing in matlab

Very simple program for listing the file names as I had to monitor the files from many folders for repetitive works.



clear all
clc
% Read directory names
dirLIST = ls;

% get number of directories
N = length(dirLIST)

% Loop through the directories
% Skip the first two..
for n = 3:N

    % Close all open figures
%     close all;
  
    thisDIR = dirLIST(n,:);

    if isempty(strfind(thisDIR,'.'))
        cd(thisDIR);
      
        ls
        pwd
        pause
%         home
      
 cd('..');

    end
end
cd ..
pwd

Thursday, March 18, 2010

Wednesday, March 17, 2010

Upgrading Texnic Center

Upgrading Texnic Center can be tricky.

When I updated it from previous version, I came across problems.
The MikTex was updated from 2.5 to 2.8. And, I ignorantly had uninstalled the 2.5 version.


I realized that changing 2.5 to 2.8 in the output section worked!!



Instead of this:
C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exeI wanted to use the Yap, it is still not working.
C:\Program Files\MiKTeX 2.8\miktex\bin

Automated Code execution in different folders as per iteration and value

I wanted to automate the code execution in different folder as per iteration.
 This works!



perc = 0.05:0.2:1;
for folder = 1:length(perc)
    percent = perc(folder);
    r = sqrt(percent/pi)*4;
  
    switch(folder)
        case 1
            cd 1
           run_me_deAR(r)
            pwd
%             pause
            cd ..
     
        case 2
            cd 2
            run_me_deAR(r)
            pwd
%             pause
            cd ..
% %         case 3
% %             cd 3
% %             run_me_deAR(r)
% %             pwd
% % %             pause
% %             cd ..
% %         case 4
% %             cd 4
% %             run_me_deAR(r)
% %             pwd
% % %             pause
% %             cd ..
% %         case 5
% %             cd 5
% %            run_me_deAR(r)
% %             pwd
% % %             pause
% %             cd ..
% %           
          
          
          
    end
end

Tuesday, March 16, 2010

Check if the data is already in there

I wanted to test if my new coming data was already contained in the set.
This is very easy!



test = rand(1,23);
A = test(5);
B = test-A;
BB = B(B==0);
if length(BB)>0
    disp('has it!!')
else
%%%  
end
%%%%%%%%%
% another attempt
clc
test = ceil(10*rand(1,10));
doit = 1;
jj =1
while doit
    A = ceil(10*rand);
    B = test-A;
    BB = B(B==0);
    if length(BB)>0
       
%         A = ceil(10*rand);
%         B = test-A;
%         BB = B(B==0);
        jj=jj+1;
        disp('test done!!')
       
    else
        doit = 0;
        %%%
    end
end




Monday, March 15, 2010

Load the matfiles as per iteration

I save the mat files as per iteration.
 This is handy just in case your program is killed.
For the post analysis, I wrote the following to load the .mat file/data.
It loads 1.mat...


for i = 1:18
    filename = [num2str(i)];
    load([filename '.mat'])
    disp('loaded')
    % do something useful
end