在MATLAB中有没有一种简单的方法来提取向量的每一个n个元素?假设我们有
x = linspace(1,10,10);
有类似这样的命令吗?
y = nth(x,3)
所以y = 3 6 9
干杯!
发布于 2011-10-25 23:12:06
试试这个:
x = linspace(1, 10, 10);
n = 3;
y = x(1 : n : end); % => 1 4 7 10
y = x(n : n : end); % => 3 6 9
发布于 2015-04-20 00:17:14
您可以对图像执行类似的操作。
% load image
img8=imread('8-bit.png');
% downsample
downSample=img8(1:2:end,1:2:end);
% upsample
upSample(1:2:end,1:2:end) = downSample(1:end,1:end)
https://stackoverflow.com/questions/7891427
复制相似问题