Converting a 3D matrix into 2D matrix correctly

조회 수: 14 (최근 30일)
R S
R S 2015년 8월 20일
댓글: Shashwar Kumar 2018년 4월 11일
Given a 2D image I had to create a vector of features for each pixel (i,j). To do that, I created a 3D matrix such that the 3rd dimension is a vector of features for the pixel. For example, (2, 3, :) represents the vector of features for pixel (2,3) in the image .
Now I need to convert this 3D matrix into 2D matrix where each row is a vector of features. I tried to understand the function reshape() but could not get it to work the way I need.
I would appreciate some expert advice
Thank you

채택된 답변

Sean de Wolski
Sean de Wolski 2015년 8월 20일
feat = reshape(x,size(x,1)*size(x,2),size(x,3))
  댓글 수: 2
Christine  Zarief
Christine Zarief 2018년 3월 10일
I have a problem I need to convert 3D matrix into 2D , 580 x 306 x 375 I want to convert it to 306*375 I mean I want to remove the first one ,how I can do it ? Thanks in advance

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

추가 답변 (1개)

R S
R S 2015년 8월 20일
Thank you !!

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by