06-22-2009
Matlab (more generally: sorting data by date)
I'm not sure if this really belongs anywhere on this forum but my previous experiences on here have shown me that you guys are very helpful so I figure I may as well try.
I have a bunch of large 2d arrays in matlab and each has a column for a date that each row corresponds to. The format is yymmdd except for everything for 2000 which is just mmdd.
I need to be able to separate the data based on season (ie DJF, MAM, JJA, SON) but I'm not sure what is the best way to go about it based on the format of the data. I could write a bunch of if statements to decide each season but the 2000 data complicates that method.
Any advice (you don't have to write anything out) would be much appreciated. It's been a few years since my last programming class and I can't remember the best practice for this.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a file where dates in the form mm/dd/yyyy is the first field. How do I sort the file by the date field?
Thanks,
Duckman (6 Replies)
Discussion started by: Duckman
6 Replies
2. UNIX for Dummies Questions & Answers
Hi at all,
I have to sort a log file on timestamp field. That's field is the third!
a log file sample.....
1|EVTVOD-1-20060709_000614|2006/07/09-0:11:23|0.3.8
1|EVTVOD-1-20060709_000614|2006/07/09-0:11:16|0.3.8
1|EVTVOD-1-20060709_000614|2006/07/09-0:11:20|0.3.8... (3 Replies)
Discussion started by: nmilella
3 Replies
3. Shell Programming and Scripting
Hi All,
I have a file say abc.txt with the below data.
1234 876S 01Mar2007 foo
1244 65DF 19Jan2007 boo
9924 234K 01Jan2006 koo
8866 8FGH 12Feb1999 roo
7777 ASDF 13May2007 soo
I need this file to be in sorted order depending on the date field.
e.g
8866 8FGH 12Feb1999 roo... (2 Replies)
Discussion started by: rinku11
2 Replies
4. Shell Programming and Scripting
Hi,
I have a list of files that take on the format ABCDE_yymmdd and wish to sort them in ascending date order. I can't use the unix time stamp for the file as this could possibly be different from the date given in the file name.
Does anyone know of any way this can be done using unix shell... (14 Replies)
Discussion started by: LiquidChild
14 Replies
5. UNIX and Linux Applications
hello,
debashish here.
i am working with 6 bit flash ADC design. So for calculation of INL and DNL ,i have to import data from cadence to MATLAB .
Can anybody help me out:confused: (1 Reply)
Discussion started by: DEBASHISH DASH
1 Replies
6. Shell Programming and Scripting
Hi,
PFB the data:
C_Random_130417
Java_Random_130518
Perl_Random_120519
Perl_Random_120528
so the values are ending with year,i.e.,130417
i want to sort the values with date.
i want the output like this:
Perl_Random_120519
Perl_Random_120528
C_Random_130417
Java_Random_130518
can... (5 Replies)
Discussion started by: arindam guha
5 Replies
7. Shell Programming and Scripting
I am trying to sort by two columns. The first column in an ID, the second is a date in the form yyyy-mm-dd. I need to sort by the ID column, then in ascending order for the date column (earliest date to most recent date compared to today).
Input data:
012-abc 2012-04-25 ... (3 Replies)
Discussion started by: mollydog11
3 Replies
8. Shell Programming and Scripting
Hello.
Sorting data file by date and time with the following issues:
Date is in the following format m/d/yyyy, no leading zeros
Time is in the following format h:m:s AM/PM, no leading zeros
Any ideas on how to sort data when the above issues?
Could the date/time be converted inline to... (5 Replies)
Discussion started by: JimBurns
5 Replies
9. UNIX for Dummies Questions & Answers
I have file having below data
01-MAY-13 2.38.11.00.100089 IN 4512 0000741881
01-JUN-13 2.38.11.00.100089 IN 1514 0000764631
01-NOV-13 2.38.11.00.100089 IN 1514 0000856571
01-NOV-13 2.38.15.00.100015 IN 300.32 0000856531
01-JUN-13 2.38.19.00.100000 IN 2698 0000764493
01-JUL-13... (2 Replies)
Discussion started by: ranabhavish
2 Replies
10. Shell Programming and Scripting
I have file a.txt having below data
cat a.txt
01-MAY-13 2.38.11.00.100089 IN 4512 0000741881
01-JUN-13 2.38.11.00.100089 IN 1514 0000764631
01-NOV-13 2.38.11.00.100089 IN 1514 0000856571
01-NOV-13 2.38.15.00.100015 IN 300.32 0000856531
01-JUN-13 2.38.19.00.100000 IN 2698 0000764493... (5 Replies)
Discussion started by: ranabhavish
5 Replies
LEARN ABOUT DEBIAN
arch::revisionbunches
Arch::RevisionBunches(3pm) User Contributed Perl Documentation Arch::RevisionBunches(3pm)
NAME
Arch::RevisionBunches - manage bunches of related revisions
SYNOPSIS
use Arch::RevisionBunches;
use Arch::Tree;
my $rb = Arch::RevisionBunches->new;
my $tree = Arch::Tree->new(".", own_logs => 1);
$rb->add_revision_descs($tree->get_history_revision_descs);
$rb->rebunch(25); # the default is 50
foreach my $bunch ($rb->get) {
print "$bunch->{version}
";
print " $_->{name} $_->{summary}
"
foreach @{$bunch->{revision_descs}};
}
foreach my $bunch ($rb->reverse_revision_descs->rebunch(30)) {
print $bunch->{name1};
print " .. $bunch->{name2}" if $bunch->{name2};
print " ($bunch->{daysago1}";
print " .. $bunch->{daysago2}" if $bunch->{name2};
print " days ago)
";
}
DESCRIPTION
This class helps front-ends to group revisions. Such grouping is essential when, for example, the version to be shown contains thousands of
revisions. The front-end may decide to show expandable bunches of 100 revisions each.
There is a support for revision descriptions (summary, date, creator, email, and in some cases associated the file name and/or the
associated version). There is a constraint by convention, one bunch may only contain revisions of the same version, and the ones
associated with the same file if applicable. It is possible to define an order of versions. It is possible to recreate bunches (rebunch)
using a different number of revisions. The constraint defines the actual number of revisions in different bunches, it is not guaranteed to
be the same.
METHODS
The following methods are available:
new, init, add_revision_descs, versions, rebunch, get, clear, reverse_revision_descs, versions, filepaths.
new [%args]
Construct Arch::RevisionBunches object.
The %args are passed to init method.
init [%args]
The %args keys may be bunch_size (to use as the default bunch size instead of 50), max_sumlen (maximal summary length to keep including
trailing ellipsis, must be greater than 5), version (if set, then all revisions are assumed to be of one version, otherwise multiple
versions are assumed), final_revision and final_filepath (the final revision and filepath for which the revision bunches are
constructed). These last two %args keys are not really used yet.
add_revision_descs [%constant_fields]
Add revision descriptions that is arrayref of hashes. See other classes that return such revision descriptions. If the %constant_fields
is given, then add these to all revision descriptions (rarely needed).
Return the object, this enables chaining of get or rebunch method call.
rebunch [bunch_size]
Group newly added revisions if no bunch_size is specified. Otherwise regroup all revisions using a given bunch_size. The default bunch
size may be specified in the constructor.
Return the same get does.
get Return bunches that is arrayref in scalar context, array in list context.
Each bunch is hashref with keys:
revision_descs
name1 daysago1 time1 tz1
name2 daysago2 time2 tz2
size
num_creators
num_other_creators
main_creator
main_email
creator
name
date
summary
and optionally "version", "is_missing" and "filepath" if applicable.
This method implicitly calls rebunch with no parameter if new revision descriptions were added that are not bunched yet.
clear
Clear all bunches and their revision descriptions.
reverse_revision_descs
Effectivelly empty all revision descriptions (both old and new) and readd them in the reverse order.
Return the object, this enables chaining of get or rebunch method call.
versions
Return distinct versions participated in all bunches. Return empty arrayref if not applicable, i.e. if version is given in the
constructor.
filepaths
Return distinct filepaths participated in all bunches. Return empty arrayref if not applicable, i.e. if revision descriptions have no
filepath.
BUGS
Waiting for your reports.
AUTHORS
Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel).
SEE ALSO
For more information, see Arch::Tree, Arch::Log, Arch::Session, Arch::Library.
perl v5.10.1 2005-02-21 Arch::RevisionBunches(3pm)