Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Urgent Matlab Help
Replies: 1   Last Post: Nov 27, 2013 2:41 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Derek Goring

Posts: 3,920
Registered: 12/7/04
Re: Urgent Matlab Help
Posted: Nov 27, 2013 2:41 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Wednesday, November 27, 2013 6:19:38 PM UTC+13, Karrar Jaffar wrote:
> I have a single filename.mat file which contains 1500 sub sim_i.mat (for i=1,.....1500) files which have the data that I want. I just have urgent questions
> 1) How to combine or merge the sub .mat files into a single .mat file containing all the data in matrix form?
> 2) How can I load the sub_i .mat files in the loops once the filename.mat is loaded in the matlab?

It is very bad practice to do this sort of thing in a panic.
You will almost inevitably stuff it up.
You need to back off and take several deep breaths, then approach it calmly and logically.

First of all, your Question 2 is actually Step 1.
You can do this in a loop:
for ifile=1:nfiles
matfile=[pth 'sub_' num2str(ifile)];

Now your Question 1 is Step 2:
save([pth 'allmyfiles'],'s')

where pth is something like: 'c:\PathToMyMatfiles\'

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.