How to save a empty matrix during simulation.
古いコメントを表示
While doing my simulation around 120 times in a loop. I am generating 7 data which is important for me. But some time in that 7 data 1 or 2 are empty matrix form which means it's nothing. But for saving all my data after 120 times. When I use dlmwrite('E_spct_118.txt', E_spct, '\t'); it show a an error that dimension does not match. When I check at that iteration my E_spct is 1* empty matrix. So please help me to save it so that my program does not stop in between of 120 simulation.
回答 (1 件)
KSSV
2017 年 8 月 11 日
As you are generating data in a loop....put a if condition, so that only non empty data will be stored and empty data gets ignored. Check the below pseudo code.
A = zeros(20,1) ;
for i = 1:20
E = rand ;
if ~isempty(E)
A(i) = E ;
end
end
カテゴリ
ヘルプ センター および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!