Making a movie from the data files in matlab

Click For Summary
SUMMARY

This discussion focuses on creating a movie from multiple data files using MATLAB. The user seeks guidance on loading over 500 files, plotting graphs, and generating movie frames in a loop. The solution involves using MATLAB's internal commands to inquire about existing files and employing text-processing functions like strcat to construct filenames. A provided example demonstrates how to read data into a cell array using dlmread within a for loop.

PREREQUISITES
  • Familiarity with MATLAB programming language
  • Understanding of file I/O operations in MATLAB
  • Knowledge of data visualization techniques in MATLAB
  • Basic experience with loops and cell arrays in MATLAB
NEXT STEPS
  • Explore MATLAB's VideoWriter function for creating video files
  • Learn about MATLAB's dlmread and readmatrix functions for data import
  • Investigate advanced plotting techniques in MATLAB for better visualization
  • Research MATLAB's file handling functions to manage large datasets efficiently
USEFUL FOR

This discussion is beneficial for MATLAB users, data analysts, and researchers who need to visualize large datasets and create animations or movies from data files.

vissu219
Messages
3
Reaction score
0
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..
 
Physics news on Phys.org
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:
%creating a cell array for data storage
all_data=cell(number_of_files,1);

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    
    all_data{i+1}=dlmread(filename_reading);
end

number_of_files, input_path, specimen_id are strings defined previously.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
7K
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K