Info

此问题已关闭。 请重新打开它进行编辑或回答。

Optimizing big size structure

1 次查看(过去 30 天)
Scott Urquhart
Scott Urquhart 2018-1-17
关闭: MATLAB Answer Bot 2021-8-20
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

回答(0 个)

此问题已关闭。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by