Path: news.mathworks.com!not-for-mail
From: "Ender " <jr147@msstate.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Undefined function or method
Date: Mon, 13 Jun 2011 19:03:19 +0000 (UTC)
Organization: Mississippi State University
Lines: 143
Message-ID: <it5mtn$24j$1@newscl01ah.mathworks.com>
References: <isr83g$60u$1@newscl01ah.mathworks.com> <isr87s$6l0$1@newscl01ah.mathworks.com> <isr8m8$82e$1@newscl01ah.mathworks.com> <isra38$chn$1@newscl01ah.mathworks.com> <isrbu8$hq8$1@newscl01ah.mathworks.com> <istfsd$cqd$1@newscl01ah.mathworks.com> <istj8u$mrn$1@newscl01ah.mathworks.com> <istvu5$2eh$1@newscl01ah.mathworks.com> <it0beu$gi$1@newscl01ah.mathworks.com> <it0bs4$1dp$1@newscl01ah.mathworks.com>
Reply-To: "Ender " <jr147@msstate.edu>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1307991799 2195 172.30.248.46 (13 Jun 2011 19:03:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 13 Jun 2011 19:03:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1035766
Xref: news.mathworks.com comp.soft-sys.matlab:731728

"Sadik " <sadik.hava@gmail.com> wrote in message <it0bs4$1dp$1@newscl01ah.mathworks.com>...
> Small correction:
> 
> plot(Press_6_7_11)
> set(gca,'XTick',1:2,'XTickLabel',date_6_7_11(:,2))
> 
> So when you use 10 points, you will say:
> 
> set(gca,'XTick',1:10,'XTickLabel',date_6_7_11(:,2))
> 
> Best.

Thanks for the help thus far. The advice that you have been giving me has helped. 

I am running into another problem. I have tried putting all of the data that I have collected for multiple days into one array. I am having problems because my data arrays are not of the same type. At least that's my guess. I thought that I fixed this when I went from {} to (), but that did not solve the problem. 

This poises a problem at the end of my code. At the end of my code, I would like to plot the data together on the same plot however my graph is not showing all of the x values. I had to use seperate arrays, and the data values start at different row values. This poses a problem whenever I plot because the x values for the second data are shown, but not the first. Here is a shorten version of my code:


% Pressure at date and time
    % Date: June 7th, 2011
        % Sample 1 
            [y, m, d, h, mn] = datevec('June 07, 2011  11:53:00 AM');
    %       date{1,1} = sprintf('Date: %d/%d/%d', m, d, y); % Month, Day, Year, 
    %       date{1,2} = sprintf('Time: %d:%d%f\n',h,mn);  % Hour, Minute
            date{1,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{1,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(1) = 6.00e-5;  % Torr
    
        % Sample 2
            [y, m, d, h, mn,] = datevec('June 07, 2011  1:45:00 PM');
            date{2,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{2,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(2) = 2.06e-5;  % Torr
        
        % Sample 3
            [y, m, d, h, mn,] = datevec('June 07, 2011  2:23:00 PM');
            date{3,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{3,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(3) = 1.70e-5;  % Torr

        % Sample 4
            [y, m, d, h, mn,] = datevec('June 07, 2011  3:10:00 PM');
            date{4,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{4,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(4) = 1.40e-5;  % Torr
     
        % Sample 5 
            [y, m, d, h, mn,] = datevec('June 07, 2011  4:08:00 PM');
            date{5,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{5,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(5) = 1.13e-5;  % Torr
    
        % Sample 6
            [y, m, d, h, mn,] = datevec('June 07, 2011  5:10:00 PM');
            date{6,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{6,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(6) = 1.10e-5;  % Torr    
        
    % Date: June 8th, 2011
        % Sample 7 
            [y, m, d, h, mn] = datevec('June 08, 2011 7:38:00 AM');
            date{7,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{7,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(7) = 4.49e-6;  % Torr
    
        % Sample 8
            [y, m, d, h, mn,] = datevec('June 08, 2011  8:42:00 AM');
            date{8,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{8,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(8) = 4.00e-6;  % Torr
        
        % Sample 9
            [y, m, d, h, mn,] = datevec('June 08, 2011  9:31:00 AM');
            date{9,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{9,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(9) = 3.83e-6;  % Torr

        % Sample 10
            [y, m, d, h, mn,] = datevec('June 08, 2011  10:18:00 AM');
            date{10,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{10,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(10) = 3.45e-6;  % Torr
     
        % Sample 11 
            [y, m, d, h, mn,] = datevec('June 08, 2011  12:00:00 PM');
            date{11,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{11,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(11) = 3.41e-6;  % Torr
    
        % Sample 12
            [y, m, d, h, mn,] = datevec('June 08, 2011  1:00:00 PM');
            date{12,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{12,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(12) = 3.39e-6;  % Torr    
                        
        % Sample 13  
            [y, m, d, h, mn,] = datevec('June 08, 2011  2:00:00 PM');
            date{13,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{13,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(13) = 3.34e-6;  % Torr
    
        % Sample 14
            [y, m, d, h, mn,] = datevec('June 08, 2011  3:00:00 PM');
            date{14,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{14,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(14) = 3.00e-6;  % Torr      
            
        % Sample 15
            [y, m, d, h, mn,] = datevec('June 08, 2011  4:00:00 PM');
            date{15,1} = sprintf('%d/%d/%d', m, d, y); % Month, Day, Year, 
            date{15,2} = sprintf('%d:%d%f\n',h,mn);  % Hour, Minute
            Press(15) = 3.29e-6;  % Torr      

 % Store date into an array
        for i = 1:15
            if i <=6
                Press_6_7_11(i,:) = Press(i);
                date_6_7_11(i,1) = date(i,1);
                date_6_7_11(i,2) = date(i,2);
                
            elseif i>6 && i<=15
                Press_6_8_11(i,:) = Press(i);
                date_6_8_11(i,1) = date(i,1);
                date_6_8_11(i,2) = date(i,2);
end
end
 % Plot the results 

        % Plot of Time-history of June 7th, 2011   
            plot(Press_6_7_11,'r--')
            set(gca,'XTick',1:6,'XTickLabel',date_6_7_11(:,2))
            
        % Hold graph so that other data can be put on the same graph
            hold on
            
        % Plot of Time-history of June 8th, 2011
            plot(Press_6_8_11,'b--')
            set(gca,'XTick',1:15,'XTickLabel',date_6_8_11(:,2))

If I take the second plot, and use 7:15 instead, MATLAB pushes my x values even further to the right, but if I use 1:15 then MATLAB does not display x values for my first set of data. How can I fix this so that I can put multiple data on one graph

--Ender--