Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Multiple input file analysis

Subject: Multiple input file analysis

From: Jetson Ronald

Date: 19 Feb, 2010 22:10:05

Message: 1 of 4

Hell
      I have set of input files in a folder. The name of the files in the folders are like
CHY023-N,
 CHY023-E,
CHY143-E,
CHY143-N,
CHY153-E,
 CHY153-N,
TCU043-E,
TCU043-N,
TCU063-E,
 TCU063-N ................
They are earthquake records in a staion in two dorection such as east and north. I want to rotale the records in other direction using the following formula
   R=E.*cos(q)+N.*sin(q);
    T=-E.*sin(q)+N.*cos(q);
I am able to access all the records using dir comment but my program should be able to read the pairs that is east and north directions records for a station together (CHY143-N,CHY153-E) then next pair. Whant i mean is it should read the records in a station simultaniously.

Regards
Jet

Subject: Multiple input file analysis

From: ImageAnalyst

Date: 19 Feb, 2010 23:31:42

Message: 2 of 4

Jet
Do you have a question?
I don't understand your formula - how are E and N numbers? Don't they
mean North and South? Is there a single number stored in each of the
files and you extract this and call it either E or N depending on the
filename it came out of???
-Image Analyst

Subject: Multiple input file analysis

From: Sadik

Date: 20 Feb, 2010 00:54:04

Message: 3 of 4

Hi Jetson,

You should first filter out the ones finishing with "-N":

listOfNorthFiles = dir('*-N.*');

[In the following, I will assume your files have a three-letter extension like .txt]

Then, in a for loop, you can use your files in a pair like this:

for pairCounter = 1:length(listOfNorthFiles)
    northFileName = listOfNorthFiles(pairCounter).name;
    eastFileName = [northFileName(1:end-6) '-E' northFileName(end-3:end)];

    fidNorth = fopen(northFileName,'r');
    fidEast = fopen('eastFileName','r');
 
    % Do whatever you want with the files. Read data, process, etc.
 
    fclose(fidNorth);
    fclose(fidEast);
end

% That's it. Best.
"Jetson Ronald" <ajetsonronald@yahoo.co.in> wrote in message <hln27t$shc$1@fred.mathworks.com>...
> Hell
> I have set of input files in a folder. The name of the files in the folders are like
> CHY023-N,
> CHY023-E,
> CHY143-E,
> CHY143-N,
> CHY153-E,
> CHY153-N,
> TCU043-E,
> TCU043-N,
> TCU063-E,
> TCU063-N ................
> They are earthquake records in a staion in two dorection such as east and north. I want to rotale the records in other direction using the following formula
> R=E.*cos(q)+N.*sin(q);
> T=-E.*sin(q)+N.*cos(q);
> I am able to access all the records using dir comment but my program should be able to read the pairs that is east and north directions records for a station together (CHY143-N,CHY153-E) then next pair. Whant i mean is it should read the records in a station simultaniously.
>
> Regards
> Jet

Subject: Multiple input file analysis

From: Jetson Ronald

Date: 20 Feb, 2010 11:51:04

Message: 4 of 4

Dear Sadik

i tried with your suggestions.
It works amazingly well!!!!!
Thanks a lot
Jet


"Sadik " <sadik.hava@gmail.com> wrote in message <hlnbrc$2pv$1@fred.mathworks.com>...
> Hi Jetson,
>
> You should first filter out the ones finishing with "-N":
>
> listOfNorthFiles = dir('*-N.*');
>
> [In the following, I will assume your files have a three-letter extension like .txt]
>
> Then, in a for loop, you can use your files in a pair like this:
>
> for pairCounter = 1:length(listOfNorthFiles)
> northFileName = listOfNorthFiles(pairCounter).name;
> eastFileName = [northFileName(1:end-6) '-E' northFileName(end-3:end)];
>
> fidNorth = fopen(northFileName,'r');
> fidEast = fopen('eastFileName','r');
>
> % Do whatever you want with the files. Read data, process, etc.
>
> fclose(fidNorth);
> fclose(fidEast);
> end
>
> % That's it. Best.
> "Jetson Ronald" <ajetsonronald@yahoo.co.in> wrote in message <hln27t$shc$1@fred.mathworks.com>...
> > Hell
> > I have set of input files in a folder. The name of the files in the folders are like
> > CHY023-N,
> > CHY023-E,
> > CHY143-E,
> > CHY143-N,
> > CHY153-E,
> > CHY153-N,
> > TCU043-E,
> > TCU043-N,
> > TCU063-E,
> > TCU063-N ................
> > They are earthquake records in a staion in two dorection such as east and north. I want to rotale the records in other direction using the following formula
> > R=E.*cos(q)+N.*sin(q);
> > T=-E.*sin(q)+N.*cos(q);
> > I am able to access all the records using dir comment but my program should be able to read the pairs that is east and north directions records for a station together (CHY143-N,CHY153-E) then next pair. Whant i mean is it should read the records in a station simultaniously.
> >
> > Regards
> > Jet

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us