필터 지우기
필터 지우기

Why can i not add these arrays to a matrix

조회 수: 2 (최근 30일)
christiaan van Weeghel
christiaan van Weeghel 2018년 2월 22일
댓글: christiaan van Weeghel 2018년 2월 22일
Hello,
i've been trying to get some data matrixes together. They contain info on certain genes. The problem is that when i try to add the required P-values Matlab gives me a horzcat eror.
I've been adding them as such: [ILM, SDG, ID, P] with ILM, SDG and ID being general information from the dataset, they work fine. But when i try to add P it stops working. The array sizes of ILM, SDG and ID are all "750x1 cell" while the P is "750x1 double". is there a way to covert one to the other?

채택된 답변

Stephen23
Stephen23 2018년 2월 22일
편집: Stephen23 2018년 2월 22일
You could convert the numeric array P into a cell array:
[ILM,SDG,ID,num2cell(P)]
But keep in mind that storing numeric data in a cell array makes accesing and processing that data more complex. If each of the other cell arrays contains only a scalar value in each cell then it might be better to convert them to one numeric array.
  댓글 수: 1
christiaan van Weeghel
christiaan van Weeghel 2018년 2월 22일
Oh that's fine, all i need to see is these final results. The processing was already done. If anything needs to change it will happen earlier in the script. Thanks for the answer.

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by