Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Optimizing big size structure

1 view (last 30 days)
Scott Urquhart
Scott Urquhart on 17 Jan 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello, I am not very familiar with structure.
I have a program that request for input an obj structure with empty value in it. This is the code that returns the correct result but it is very slow. I was wondering if there were a different way to get to the same result but a lot faster?
tic
obj.FFT_h0=struct;
obj.FFT_h1=struct;
obj.FFT_h3=struct;
obj.FFT_h5=struct;
obj.FFT_h7=struct;
obj.FFT_h9=struct;
fft_buffer_size=2^14;
for i=1:fft_buffer_size
obj.FFT_h0(i,1).timestamp=[];
obj.FFT_h0(i,1).mag=[];
obj.FFT_h0(i,1).phase=[];
obj.FFT_h1(i,1).timestamp=[];
obj.FFT_h1(i,1).mag=[];
obj.FFT_h1(i,1).phase=[];
obj.FFT_h3(i,1).timestamp=[];
obj.FFT_h3(i,1).mag=[];
obj.FFT_h3(i,1).phase=[];
obj.FFT_h5(i,1).timestamp=[];
obj.FFT_h5(i,1).mag=[];
obj.FFT_h5(i,1).phase=[];
obj.FFT_h7(i,1).timestamp=[];
obj.FFT_h7(i,1).mag=[];
obj.FFT_h7(i,1).phase=[];
obj.FFT_h9(i,1).timestamp=[];
obj.FFT_h9(i,1).mag=[];
obj.FFT_h9(i,1).phase=[];
end
toc

Answers (0)

This question is closed.

Products

Community Treasure Hunt

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

Start Hunting!