How to convert a column vector into an image
4 次查看(过去 30 天)
显示 更早的评论
Hello sir
I have an vector of size (258x1). Now I want to convert it into a square matrix (101x101) i.e. in 2D image in matlab.
Please help me.
7 个评论
采纳的回答
Walter Roberson
2019-5-23
nrow = 6; ncol = 6;
B = full( sparse(C(:,1), C(:,2), A, nrow, ncol) );
Or
nrow = 6; ncol = 6;
B = accumarray(C, A(:), [nrow ncol]);
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!