How can i use Discrete wavelet transform (DWT) on a matrix

4 visualizzazioni (ultimi 30 giorni)
I have data set of 327 subjects i have read all the dataset in one variable that is T1. T1 size is 1 x 327 and each cell has 19200 x 14. i want to read each data and perform dwt on each one data i.e 19200x 1 and i want it in a loop ( like 1 to 14). I want 2 - level dwt and db4 and extract detail and approximation in matrix
Can someone please help me i have done several methods but didn't get the answer
%% READING THE DATA
% Task1
myFolder = 'D:\Finall Sorted data\Task 1';
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.csv');
theFiles = dir(filePattern);
n = length(theFiles);
for k = 1 : n
baseFileName = theFiles(k).name;
T1{k} = readmatrix(fullfile(theFiles(k).folder, baseFileName));
end
S = [];
P = 0;
sz = 0; % Size of matrix
for i = 1 : 327
S{i} = T1{1,i}; % to read the data
for j = 1 : 14
P = S(1:19200:j);
sz = size(P);
% dwt method
end
end
  5 Commenti
Sameer Ingale
Sameer Ingale il 4 Feb 2023
Modificato: Sameer Ingale il 4 Feb 2023
I want the size of data within S.
so what should i use to instead of cell array to process ?
Walter Roberson
Walter Roberson il 4 Feb 2023
for j = 1 : 14
P = S(1:19200:j);
Suppose j were 1. Then you would have S(1:19200:1) . But the end value is the same as the initial value, so that will be just S(1) . The same is true for all the other values of j from 1 to 14. j would have to be at lest 19201 for 1:19200:j to include more than one element.
Where you for some reason interested in 1:j:19200 ? That is, the first time [1, 2, 3, 4, ...] and the second time [1, 3, 5, 7, ...] and the third time [1 4 7 10, ...] and so on? Or were you interested in S(1:19200,j) ?
size(1:19200,j) is going to be 19200 x 1 unless j is non-scalar (or is the logical value false)
If you want to know about the size of the data in T1 then you would be more likely to use
S = T1{1,i};

Accedi per commentare.

Risposte (1)

Nayan
Nayan il 11 Apr 2023
Hi
As I understand you want to perfrom discrete wavelet transform on a matrix. This can be performed using dwt2(X,wname).
For futher querry you can share the Data and the exact description of problem that you are facing.
Happy to help!

Categorie

Scopri di più su Discrete Multiresolution Analysis in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by