From: Alex Eptas on
Hi still unfortunately i am having problems selecting characters from file names due to the fact that the stock ID's are between 2 and for characters long, for example..

TESCO_20081225
AB_20060914
AAL_20070914

I want to get a vector of stock ID's and a vector of dates.

my code so far is as follows;

clear;
rootDir = 'C:\Users\Desltop\Dissertation Data\lse

tmp = dir([rootDir '*.csv']);
fnames = char({tmp.name}');
clear tmp;

If the stock ID's had all been of equal length, i.e. 3 characters i know i could have used;

stockIDs = unique(cellstr(fnames(:1:3)));

But because they are not this does not give the required result.

Please could someone (give constructive) advice how to solve this problem. Please note i am a very new user to matlab so please keep sarcastic comments to yourself.

Many thanks
Alex
From: us on
"Alex Eptas" <fe09ae(a)mail.wbs.ac.uk> wrote in message <i2i447$9sa$1(a)fred.mathworks.com>...
> Hi still unfortunately i am having problems selecting characters from file names due to the fact that the stock ID's are between 2 and for characters long, for example..
>
> TESCO_20081225
> AB_20060914
> AAL_20070914
>
> I want to get a vector of stock ID's and a vector of dates.
>
> my code so far is as follows;
>
> clear;
> rootDir = 'C:\Users\Desltop\Dissertation Data\lse
>
> tmp = dir([rootDir '*.csv']);
> fnames = char({tmp.name}');
> clear tmp;
>
> If the stock ID's had all been of equal length, i.e. 3 characters i know i could have used;
>
> stockIDs = unique(cellstr(fnames(:1:3)));
>
> But because they are not this does not give the required result.
>
> Please could someone (give constructive) advice how to solve this problem. Please note i am a very new user to matlab so please keep sarcastic comments to yourself.
>
> Many thanks
> Alex

see the many solutions posted in reply to your similar underscore problem...

us