mat*_*trj 0 matlab loops for-loop vector
我试图将具有2928个值的矢量转换为具有8784个值的矢量.第一个向量是一个信息,其间隔为3小时,我想有一个每小时向量,这些值每3小时加一次,剩下的应该用NaN填充.我的第一个方法是创建一个具有8784个值的NaN向量,但之后我无法创建一个与之配合使用的"for循环".
为了简单起见,我将尝试用一个例子来解释(n是最小向量的值的数量):
S_3h = ones(n,1); % this acts as the small vector that has only information each 3hours
B_h = nan(3*n,1); %this is the created hourly vector that I want to fulfill
Run Code Online (Sandbox Code Playgroud)
想要的结果是:
B_h = [1 nan nan 1 nan nan 1 nan nan 1 nan nan ...]
Run Code Online (Sandbox Code Playgroud)
你能帮我吗?非常感谢你提前!