How to add sequence data into a sequence database

4 vues (au cours des 30 derniers jours)
MBUNYA NERVILLE ANYANG
MBUNYA NERVILLE ANYANG le 14 Juil 2023
Réponse apportée : Animesh le 21 Nov 2024 à 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")
L1 = 72×6
24.6000 0 0 0 0 149.0000 24.6000 0 0 0 0 139.0000 24.8000 0 0 0 0 127.0000 25.1000 0 0 0 0 114.0000 25.2000 0 0 0 0 100.0000 25.1000 26.0000 0 0 77.9730 86.0000 25.1000 125.0000 145.0000 9.0000 276.9108 72.0000 25.5000 236.0000 228.0000 82.0000 351.5500 58.0000 26.2000 325.0000 252.0000 150.0000 623.3732 45.0000 26.7000 398.0000 261.0000 83.0000 707.3739 32.0000
Q= flip(L1)
Q = 72×6
23.7000 0 0 0 0 153.0000 23.6000 0 0 0 0 151.0000 23.8000 0 0 0 0 142.0000 24.4000 0 0 0 0 131.0000 24.8000 75.0000 0 0 185.7448 118.0000 25.5000 89.0000 0 0 277.4559 104.0000 26.2000 98.0000 0 2.0000 332.6769 91.0000 26.3000 97.0000 35.0000 1.0000 325.8987 77.0000 26.1000 198.0000 83.0000 7.0000 332.8428 63.0000 26.0000 320.0000 25.0000 12.0000 411.8349 49.0000
A= Q(:,1)
A = 72×1
23.7000 23.6000 23.8000 24.4000 24.8000 25.5000 26.2000 26.3000 26.1000 26.0000
B= Q(:,2)
B = 72×1
0 0 0 0 75 89 98 97 198 320
C= Q(:,3)
C = 72×1
0 0 0 0 0 0 0 35 83 25
D= Q(:,4)
D = 72×1
0 0 0 0 0 0 2 1 7 12
E= Q(:,5)
E = 72×1
0 0 0 0 185.7448 277.4559 332.6769 325.8987 332.8428 411.8349
F= Q(:,6)
F = 72×1
153 151 142 131 118 104 91 77 63 49
[row colo]= size(Q)
row = 72
colo = 6
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
Database = 1×1 cell array
{6×24 double}
Database = 2×1 cell array
{6×24 double} {6×24 double}
Database = 3×1 cell array
{6×24 double} {6×24 double} {6×24 double}
Database = 4×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 5×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 6×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 7×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 8×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 9×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 10×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 11×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 12×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 13×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 14×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 15×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 16×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 17×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 18×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 19×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 20×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 21×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 22×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 23×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 24×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 25×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 26×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 27×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 28×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 29×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 30×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 31×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 32×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 33×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 34×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 35×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 36×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 37×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 38×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 39×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 40×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 41×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 42×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 43×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 44×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 45×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 46×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 47×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 48×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
Database = 49×1 cell array
{6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double} {6×24 double}
[rt,ct] = size(Database)
rt = 49
ct = 1
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 commentaire
Jon
Jon le 14 Juil 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.

Connectez-vous pour commenter.

Réponses (1)

Animesh
Animesh le 21 Nov 2024 à 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');

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by