필터 지우기
필터 지우기

How to convert a column vector into an image

조회 수: 3 (최근 30일)
Boni_Pl
Boni_Pl 2019년 5월 22일
댓글: Boni_Pl 2019년 5월 23일
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
Walter Roberson 2019년 5월 23일
What data type is the vector, such that it has two values per entry ?
Boni_Pl
Boni_Pl 2019년 5월 23일
if A=[1;2;3;6;4;8;9] and coordinates are C=[3 4;1 2;5 6;4 5;5 3;1 6;6 6] so if a matrix is B=zeros(6, 6) then how can I replace each elements of A vector with B matrix using the coordinates points

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
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!

Translated by