Borrar filtros
Borrar filtros

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

3 visualizaciones (últimos 30 días)
Sameer Ingale
Sameer Ingale el 3 de Feb. de 2023
Respondida: Nayan el 11 de Abr. de 2023
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 comentarios
Sameer Ingale
Sameer Ingale el 4 de Feb. de 2023
Editada: Sameer Ingale el 4 de Feb. de 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 el 4 de Feb. de 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};

Iniciar sesión para comentar.

Respuestas (1)

Nayan
Nayan el 11 de Abr. de 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!

Community Treasure Hunt

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

Start Hunting!

Translated by