Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个P大小矩阵,3975 x 12下面给出了下载链接。每列中的行数Pnot由 NaN给出3975/sizesBlock,其中sizesBlockis [1 3 5 15 25 53 75 159 265 795 1325 3975]。如何替换所有那些包含NaN这样的列,以便列中的每个数字j按次重复sizesBlock(j)。有什么快速/有效的方法吗?谢谢。
P
3975 x 12
NaN
3975/sizesBlock
sizesBlock
[1 3 5 15 25 53 75 159 265 795 1325 3975]
j
sizesBlock(j)
矩阵P可以从这里下载。
iSeries = 1; for iBlock = sizesBlock temp = repmat(P(1:(sizesBlock(end)/iBlock), iSeries), iBlock, 1); temp = reshape(reshape(temp, (sizesBlock(end)/iBlock), iBlock)', sizesBlock(end), 1); modifiedP(:, iSeries) = temp; iSeries = iSeries + 1; end