How to add sequence data into a sequence database
4 views (last 30 days)
Show older comments
I wish to add new data into a sequence database (49x1 cell). I have the database created as presented below from dataset D2 (72x6). I wish to add new dataset D3(72x6) into the seqhence database to have (121x1 cells). Please How do I proceed. I am a novice at the moment.
clear,clc;
L1 = xlsread("D2.xlsx")
Q= flip(L1)
A= Q(:,1)
B= Q(:,2)
C= Q(:,3)
D= Q(:,4)
E= Q(:,5)
F= Q(:,6)
[row colo]= size(Q)
SequenceLength= 24;
Database= {};
resultDatabase =[];
count=0;
for i= row:-1: SequenceLength
count=count+1;
a1 = A(i-SequenceLength+1:i)';
a2 = B(i-SequenceLength+1:i)';
a3 = C(i-SequenceLength+1:i)';
a4 = D(i-SequenceLength+1:i)';
a5 = E(i-SequenceLength+1:i)';
a6 = F(i-SequenceLength+1:i)';
Database{count,1}=[a1;a2;a3;a4;a5;a6]
end
[rt,ct] = size(Database)
count=0;
for i=1: rt-1
count=count+1;
a5= Database{count+1,1};
resultDatabase(count,1)= a5(5,end);
end
LDatabase = Database;
save LDatabase
1 Comment
Jon
on 14 Jul 2023
I can't follow from initial explanation and your code what you are actually trying to accomplish. Can you please provide a simple example illustrating what are your inputs, and what is your desired output.
Answers (1)
Animesh
on 21 Nov 2024 at 4:57
To add a new dataset "D3" to your sequence database, you need to repeat the process you used for "D2", but append the results to the existing "Database". Here's how you can modify your script to achieve this:
% Load and process dataset D3
L2 = xlsread("D3.xlsx");
Q2 = flip(L2);
A2 = Q2(:,1);
B2 = Q2(:,2);
C2 = Q2(:,3);
D2 = Q2(:,4);
E2 = Q2(:,5);
F2 = Q2(:,6);
[row2, ~] = size(Q2);
% Append sequences from D3 to Database
for i = row2:-1:SequenceLength
count = count + 1;
a1 = A2(i-SequenceLength+1:i)';
a2 = B2(i-SequenceLength+1:i)';
a3 = C2(i-SequenceLength+1:i)';
a4 = D2(i-SequenceLength+1:i)';
a5 = E2(i-SequenceLength+1:i)';
a6 = F2(i-SequenceLength+1:i)';
Database{count,1} = [a1; a2; a3; a4; a5; a6];
end
% Save the updated Database
LDatabase = Database;
save('LDatabase.mat', 'LDatabase');
0 Comments
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!