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

3 次查看(过去 30 天)
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 个评论
Sameer Ingale
Sameer Ingale 2023-2-4
编辑:Sameer Ingale 2023-2-4
I want the size of data within S.
so what should i use to instead of cell array to process ?
Walter Roberson
Walter Roberson 2023-2-4
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};

请先登录,再进行评论。

回答(1 个)

Nayan
Nayan 2023-4-11
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!

类别

Help CenterFile Exchange 中查找有关 Discrete Multiresolution Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by