Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Making a movie from the data files in matlab

  1. Sep 13, 2008 #1
    hi guys..i have a set of datafiles(more than 500)for each set i have to plot a graph and make a movie with them.. i want to knw how do i load all these files and plot them in a loop..the files are named as v1 v2 etc...and simeltaneously generate frames and make a movie.pls help ppl..
  2. jcsd
  3. Oct 5, 2008 #2


    User Avatar
    Science Advisor
    Gold Member

    simple example from a m - file have on "desk". The way usually do it is to inquire what files exist in a folder (using internal matlab commands for this) or derive the filenames using text-processing functions like strcat below, and then do the reading and storing in a for loop. Further processing then similarly, easiest to do it all in m - files.

    Code (Text):

    %creating a cell array for data storage

    for i=0:number_of_files-1
        %filename for current read
        filename_reading=strcat(input_path,specimen_id,'_',int2str(i) ,'.matlab_ascii');
        %reading all data to a cell array, +1 to get proper indices    
    number_of_files, input_path, specimen_id are strings defined previously.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook