COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### operations on multiple files

• Email
• Follow

```I have the following 3 sets of files in .mat format
X1
X2
X3    ......

I loaded all of them and i want to do the following
t1=X1(:,2)./1000;
t2=X2(:,2)./1000;
t3=X3(:,2)./1000;

x1=-X1(:,4)*0.001;
x2=-X2(:,4)*0.001;
x3=-X3(:,4)*0.001;

tr11=t1-(x1./vr);
tr21=t2-(x2./vr);
tr31=t3-(x3./vr);

can some one help me how to do it when i have 100's of files.
Thank you in anticipation
cheers
```
 0

See related articles to this posting

```On May 5, 4:44=A0pm, "subbu " <ysr...@yahoo.com> wrote:
> I have the following 3 sets of files in .mat format
> X1 =A0 =A0 =A0
> X2 =A0
> X3 =A0 =A0...... =A0 =A0 =A0 =A0 =A0 =A0
>
> I loaded all of them and i want to do the following
> t1=3DX1(:,2)./1000; =A0
> t2=3DX2(:,2)./1000;
> t3=3DX3(:,2)./1000; =A0
>
> x1=3D-X1(:,4)*0.001;
> x2=3D-X2(:,4)*0.001;
> x3=3D-X3(:,4)*0.001;
>
> tr11=3Dt1-(x1./vr); =A0 =A0 =A0
> tr21=3Dt2-(x2./vr); =A0 =A0
> tr31=3Dt3-(x3./vr); =A0
>
> can some one help me how to do it when i have 100's of files.
> Thank you in anticipation
> cheers

Don't load them into variables like that. See the Matlab FAQ 4.6:
http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_create_variables_A1.2C=
_A2.2C....2CA10_in_a_loop.3F

When you load your files into a cell array, then you can use a for
loop to go through and process each cell as you do above. (Note: Use
{} (braces) to get the value within a certain cell)

-Nathan
```
 0

1 Replies
199 Views

Similar Articles

12/20/2013 11:13:37 PM
page loaded in 115730 ms. (0)

Similar Artilces:

Multiple operations in a procmail .rc file help
I am new to procmail and have set up a basic procmailrc file but I have the following questions and need help with a script: When mail is received (all of this goes to an info@ account) I need to : 1 - Check the subject 2 - If subject contains some text string then (from a webform) 2a - check the body of the message for some keywords 2b - for each of these keywords found send a specific mail message based on this keyword. (Actually the mail message can be concatenated since someone may have multiple key words. 3- If the subject is anything else then just send a standard message....

how to create multiple gatelevel files from multiple rtl files during synthesis
When I started this project I only had one file in the prject I got used to the convention of a.v creating a_timesim.v creating a_synthesis.v creating a_timesim.sdf Now that I have 3 modules designed and in separate files I would like to continue the above convention. When I ticked the Generate Multiple Hierarchical Netlist files button I got a,v creates a_a_sim.v b.v creates b_synthese.v Is there any way of continuing the first naming convention. Do I need a different synthesis option or to write a tcl script to do it? Thanks in advance for any pointers. Andy ...

How can I produce multiple output flat files from a single SQL file with multiple SQL statements?
Hi Folks, I'm used to a UNLOAD command that allows me to dump to a named flat file the results of any SELECT statement. Hence one can build a single SQL file which contains multiple SQL statements each of which 'unloads' to its own unique file. unload to 'file1.txt' select * from ...... unload to 'file2.txt' select * from ...... and so on.... I have a requirement to write a stop gap set of SQL to dump 10 flat files from SQL server 2005. I'd like to gather all these SQL statements into 1 or 2 SQL files so Ops have an easy life running them and to remove as mu...

multiple files into one file based on unique entry in one of the files
I have 4 flat files where each field is separated by a pipe |. In each file the second field has a unique value that is in all the files. Each line is terminated by a newline. I what to combine each file and create one file. In this one file, there should be one line for each "unique" entry in that was found in the second file. I was able to do this in MS access by creating each file as table and linking the "unique" field in the 2nd file to the other files. I want do this in Tcl, so I can automate the process. Come some please point me in a starting directio...

Multiple Tables vs Multiple Files
OK, so I am experimenting with FMP 7 and converting some of my old solutions which involve multiple file relationships. I just say "convert", FMP 7 does it, and the converted solution works fine. But I'm feeling kind if inadequate because I haven't used any of the new super-duper features of FMP 7. What is the advantage of converting these multiple files to multiple tables in one file? It would be a lot of work redefining all the relationships and layouts and I don't see how it would work any different when I was done. -- Nelson It would probably be worthwh...

tailing multiple files in to log file
I have over 60 seporate files that I would like to tail the last 10 lines of and ,erge in to one file. i would like to write a shell script to do this but am having fun knowing where to start. i have looked at the manual for tail and can see that it can do muliple files but will i have to name all of the seporate filenames or could i use a dos like switch of *.txt for these files and then tail the output to the file i want. any help gratefully recived a windowz dos freek ! ! "sally.bridges@gmail.com" <sally.bridges@gmail.com> writes: > I have over 60 seporate files tha...

How to create a .a ( archive ) file from multiple .a files
I m using HP UNIX I wanted to make a single archive file from multiple .a files by pulling in all the .o modules contained within each of these .a files. Thanks --sony sonyantony@hotmail.com writes: > I wanted to make a single archive file from multiple .a files by > pulling in all the .o modules contained within each of these .a files. And what is stopping you from doing that? mkdir tmp.\$\$ && cd tmp.\$\$ && ar x ../libfoo.a && ar xv ../libbar.a && ar r ../libcombined.a *.o && cd .. && rm -rf tmp.\$\$ Cheers, -- In order to unde...

merging multiple files into a single file
Hi all, I am a beginner in Awk. I needed to do the following. Suppose I have n files, file_1, ......file_n. Each file has two fields, col1 col2. I want to create a new file, new_file_name, which will contain the following. First two columns will come in from file_1, verbatim (no change), After that I want only the second column from each of the files, file_2 through file_n, written side by side. Here is an example: file_1 file_2 file_3 ........ etc file_n col1 col2 col1 col 2 col1 col2 col1 col2 The new_file_name will have the followi...

I/O operation, file operation behaviou
Please see the following program. My intention is to open the file (create it if it does not exist), or if the file exists already it should be truncated (the entire contents is thrown away) and over written. "Create if does not exists works fine", What is wrong with the truncating part ?. fd.is_open returns false always. #include <iostream> #include <fstream> #include <string> #include <set> using namespace std; class CFileXP { public: void open(std::string type); void close(string method); private: std::set< string> openFiles; std::string f...

Mirroring with multiple file groups and files
I'm in the process of setting up a test box and I've got a question on Mirroring. I'm using SQL 2008 SP2 64 Bit. I've split the DB into various file groups and files per file group (4 each as there are 4 cores on my test box, but live will have 8 core) as we're aiming to pick the hardware to suit the I/O needs of the data instead of having one large lump. These are all on the same box at the moment (4 instances purely for my testing). So, prior to mirroring, I've set up the FG's etc... on the soon to be principal. I did the same on the Mirror as it was scripted a...