Info

This question is closed. Reopen it to edit or answer.

Naming Mechanism for a Large Database to Sort Out Parameters

1 view (last 30 days)
Hello MATLAB World. I am working on taking data out of a large Excel file and sorting it out into separate parameters for each day and each cell that looks something like the below table:
DAY 01 | DAY 02 | DAY 03 | .... | DAY 10 |
CELL01 | P1 P2 P3 ... P12 | P1 P2 P3 ... P12 | P1 P2 P3 ... P12 | .... | P1 P2 P3 ... P12|
CELL02 | P1 P2 P3 ... P12 | P1 P2 P3 ... P12 | P1 P2 P3 ... P12 | .... | P1 P2 P3 ... P12|
CELL03 | P1 P2 P3 ... P12 | P1 P2 P3 ... P12 | P1 P2 P3 ... P12 | .... | P1 P2 P3 ... P12|
....
CELL72 | P1 P2 P3 ... P12 | P1 P2 P3 ... P12 | P1 P2 P3 ... P12 | .... | P1 P2 P3 ... P12|**
You might ask from the code why there is a skip for the days, well from days 1-10 (everyday) days 13-40 (every third day), and days 45-120 (every five days). Each parameter P1 P2 P3 ... P12 is a [71x1] vector/matrix. I am trying to create a matrix name for each of the vectors so I can call on command as well as for plotting purposes. It would be amazing if someone could help me out here.
~ Thanks, Austin
close all, clear all, clc
fprintf('Begin Program\n\n');
time_i = cputime; % Initial Program Time
RawData = xlsread('file001.xlsx','AllData',' B002:PR5328');
sizeRawData = size(RawData)
cells = [01,02,03,04,05,06,07,08,09,10,11,12,...
13,14,15,16,17,18,19,20,21,22,23,24,...
25,26,27,28,29,30,31,32,33,34,35,36,...
37,38,39,40,41,42,43,44,45,46,47,48,...
49,50,51,52,53,54,55,56,57,58,59,60,...
61,62,63,64,65,66,67,68,69,70,71,72]
days = [1,2,3,4,5,6,7,8,9,10,...
13,16,19,22,25,28,31,34,37,40,...
45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120]
% Note : 01-10 = 01-10 / 11-20 = 13-40 / 21-36 = 45-120
para = [1,2,3,4,5,6,7,8,9,10,11,12]
cellsL = length(cells);
daysL = length(days);
paraL = length(para);
cflag = 'cell';
dflag = 'day';
pflag = 'para';
for cc = 1:1:cellsL
for ddi = 1:1:daysL
dd = days(ddi);
for pp = 1:1:paraL
if cc<10, cflag = 'cell0'; else cflag = 'cell'; end
if dd<10, dflag = 'day00'; elseif dd < 100, dflag = 'day0'; else dflag = 'day'; end
if pp<10, pflag = 'para0'; else pflag = 'para'; end
%%%%STUCK HERE %%%
name = [cflag num2str(cc) dflag num2str(dd) pflag num2str(pp)];
% CDP = [file001(cc+(70*(cc-1)):cc+(70*(cc)),pp*dd+cc-1)];
end
% fprintf('\n')
end
end
time_f = cputime; % Final Program Time
time_d = time_f - time_i; % Elapsed Program Time
fprintf('\nEnd Program \n');
fprintf('Time Elapsed (seconds) = %5.5f \n',time_d);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!