本文介绍了如何在MATLAB中创建循环缓冲区以正确顺序进行连续测量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我阅读了以下内容:,问题.我想知道是否有可能按顺序而不是按问题中的顺序存储值,而无需在每次迭代后求助于fliplr(从左向右翻转)?
I read the: , question. I wanted to know if its possible to store values in sequence instead of in reverse as in the question, without resorting to fliplr (flip left to right) after each iteration?
推荐答案
从前到后:
buffSize = 10;
circBuff = nan(1,buffSize);
for newest = 1:1000;
circBuff = [circBuff(2:end) newest]
end
circBuff = 991 992 993 994 995 996 997 998 999 1000
circBuff = 991 992 993 994 995 996 997 998 999 1000
返回页首:
buffSize = 10;
circBuff = nan(1,buffSize);
for newest = 1:1000;
circBuff = [newest circBuff(1:end-1)]
end
circBuff = 1000 999 998 997 996 995 994 993 992 991
circBuff = 1000 999 998 997 996 995 994 993 992 991
这篇关于如何在MATLAB中创建循环缓冲区以正确顺序进行连续测量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!