How to write multiple files in Matlab
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: How to write multiple files in Matlab

Threaded View

  1. #1
    Join Date
    Nov 2012

    How to write multiple files in Matlab

    Hello everyone! I'm fairly new to Matlab, and I'm facing a task that is very difficult.
    I have a program, used to analyze some data collected, and I need an outcome with a series of matrices. I'm stuck in how to write those matrices, with a for cycle. I've come up with this

    for i=20:40                                                      
        filenamewrite = (['ev_media' num2str(i) '.dat'],'i');
        filewrite = [pathwrite filenamewrite];
    but it comes up with a warning saying that: "Expression or statement is incorrect--possibly unbalanced (, {, or [.

    And this is what the program will have to do (the first for is what I added, all the other operations are from the previous program, that I have to repeat for a certain number of times)

    for   k=21:40 
        for i = 1:II            %this recombines the matrices studied, to be plotted on a different software
            for j = 1:JJ
                III(i,j) = i;
                JJJ(i,j) = JJ+j-1;
        IIrs          = reshape(III,II*JJ*K,1);
        JJrs          = reshape(JJJ,II*JJ*K,1);
        Uboxrs        = reshape(Ubox,II*JJ*K,1);
        Vboxrs        = reshape(Vbox,II*JJ*K,1);
        MatrOutput = [IIrs JJrs Uboxrs Vboxrs];   %I need this for all the output matrices.
        %MatrOutput = [IIrs JJrs Xboxrs Yboxrs Uboxrs Vboxrs];
        dlmwrite(filewrite,['Zone T="Snapshot=1"'],'-append','delimiter','')

    Can any of you, please, give me some help on this?
    Last edited by GremlinSA; November 23rd, 2012 at 07:09 AM. Reason: applied code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center