Prev: Creating movie with sound
Next: using struct as simulink model argument values in referenced model
From: dpb on 18 Sep 2009 09:27 dpb wrote: > dpb wrote: >> Vinny wrote: >> ... >>>>> ... I have not been able to concatenate the >>>>> columns (in either excel or Matlab) to make a D/M/Y/H/M/S format >>>>> matlab might understand. .... > Anyway, I copied your previous data to file 'date.dat' > > [d,t,am,x] = textdata('date.dat', '%s %s %s %f'); % date time ampm data > s % look at the date strings > dn=datenum(s); % convert to datenums > > I assume from this point you should be able to plot and fiddle with tick > labels to get a suitable graph. .... Sorry, I left out the concatenation part... [d,t,am,x] = textdata('date.dat', '%s %s %s %f'); for i=1:length(d) s(i,:) = [char(d(i)) ' ' char(t(i)) char(ap(i))]; end char() converts the cell strings to character arrays; it's sorta' a pita w/ ML string-handling that strcat() will strip trailing blanks w/ no option to handle them different and at least w/ my old version (R12) the underlying horzcat() won't allow for directly concatenating them while residing as cellstr nor will datenum() accept the result anyway... I'd never used datetick() and forgot it even existed; plot(dn,x); datetick('x') gave at least a reasonable result (albeit not particularly interesting w/ the data... :J) ) hth... --
First
|
Prev
|
Pages: 1 2 Prev: Creating movie with sound Next: using struct as simulink model argument values in referenced model |