My MATLAB Notes
Please note, this is my MATLAB quick notes I don't actively correct the errors on this page

# DAT 2 MAT Convertor
% Nov 16
% Converting CSV files to Matlab variable files in Batch


clc;
close all;
clear all;

matfiles = dir('*.dat');

for ind = 1:length(matfiles)
    disp 'Processing:';
    a = mat2str(matfiles(ind).name);
    disp a;
    a = strrep(a,'.dat','');
    M = csvread(matfiles(ind).name);
    eval(sprintf('%s = M;',a));
    eval(sprintf('save %s;',a));
    clear a M 
end
disp 'Done ...';






Home | last update Nov 16, 2008