From: Peter Smith on 29 Jul 2010 20:38 Hi could someone help me resolve this problem i have 310 .mat files - from these 310 files i want to : sequentially open up a variable - spreadMat : calculate an average of each of the numbers in spreadMat : insert the numbers into a matrix, where the dimentions are (length(dates), length(AveragDailySpread)) - so i will effectively insert one row for every file. Once i have done this for the first file i want it to loop through, inserting the appropriate data into the correct rows; clear; rootDir = 'C:\Users\Alex Eptas\Desktop\ChiXDaily\'; tmp = dir([rootDir '*.mat']); fnames = char({tmp.name}'); clear tmp; dates = unique(cellstr(fnames(:,1:8))); for i=1: length(dates) FullFnames = ['C:\Users\Alex Eptas\Desktop\ChiXDaily\' dates{i} '_chix.mat']; load(FullFnames , 'spreadMat') AverageDailySpread = nanmean(spreadMat(:,1:244)); Problem - is there a way to save a named averageDailySpread for every date, e.g. AverageDailySpread20071004 , AverageDailySpread20071005 At the moment when i run the loop, it just shows the AverageDailySpread for the last date. Help would be very much appreciated
From: Peter Smith on 30 Jul 2010 00:42 Please Note this has now been solved by myself - no need to reply
|
Pages: 1 Prev: Massive difference in run-time between matlab and simulink calculations Next: plot colour |