How to add sequence data into a sequence database
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MBUNYA NERVILLE ANYANG
el 14 de Jul. de 2023
Respondida: Animesh
el 21 de Nov. de 2024 a las 4:57
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 comentario
Jon
el 14 de Jul. de 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.
Respuestas (1)
Animesh
el 21 de Nov. de 2024 a las 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 comentarios
Ver también
Categorías
Más información sobre Database Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!