loading a .mat file and applying hilbert transform
2 次查看(过去 30 天)
显示 更早的评论
I have .mat fle in which data is saved in 4*4 uint8 struct format. when I try to apply Hilber Transform it is showing like below please help me solving this memory problem.(I am executing this in r2020a online matlab)
Error using fft
Requested 720x1280x3x200 (8.2GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive.
Error in hilbert>hilbert_ml (line 67)
x = fft(xr,n,1); % n-point FFT over columns.
Error in hilbert (line 41)
x = hilbert_ml(xr);
I need to load this file and apply hilbert transform for calculating instant phase and amplitude of 2 oscillators separately so that subsequently I can calculate relative phase by substracting them. please help me doing this
2 个评论
Walter Roberson
2020-9-6
What is the size() of your input? What is the class() of your input?
Is your input 720 x 1280 x 3 ? Did you request a hilbert size of 200 ?
回答(1 个)
Walter Roberson
2020-9-6
You appear to be asking for the hilbert transform of a 720 x 1280 RGB matrix, asking for 200 data points in the transform.
The first question I would ask is whether you should really be taking the hilbert transform of an RGB matrix. You talk about taking the phase and amplitude of two oscillators, but data for oscillators is much more likely to be a 2D array -- or possibly a 3D array with third dimension size 2, with one layer for each oscillator.
720 x 1280 x 3 is just too common of an image size to think the data is from anything other than an image.
Perhaps you need to identify data from the image, using one of the Digitizer programs in the File Exchange?
Secondly: When you ask to take the hilbert transform of a non-vector, then MATLAB will take the hilbert transform of each column independently. You can therefore avoid using a single large array by breaking the calculation up into pieces, such as doing 256 columns at a time (1280 = 256 * 5). However... you still need to store all of the results, so unless you can compact down 720 x 256 x 3 x 200 into a smaller matrix, you would still end up needing 720 x 1280 x 3 x 200 memory... even if you have just split that memory into several arrays.
2 个评论
Walter Roberson
2020-9-6
I do not see any 4*4 uint8 data as yet? You have a 720 x 1280 x 3 uint8 matrix. Are you wanting to divide that into blocks that are 4 x 4 x 3 and do the hilbert() transform of those? If so then see blockproc()
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!