필터 지우기
필터 지우기

Add an extra column to the existing matrix (MAT file)

조회 수: 17 (최근 30일)
Chathu
Chathu 2016년 4월 9일
댓글: Chathu 2016년 4월 10일
I have a mat file and its size is 1243x1182x3 . (please note that size of the Mat file is NOT consistent and there are about 50-60 MAT files in one folder). And i want to add an extra column to the Mat file? (columns in the matrix are x and y columns. And my requirement is to add a 3rd column which is z column to the matrix) I guess i can do two things:
  1. Use save(filename, ..., '-append')But the class of my MAT file is uint8. But the examples i have seen were in the class Double.
  2. Or else i have to write it in a cell array
for n=1:10
A=rand(5);
[i,j,vals]=find(A);
data={[i,j,vals]};
save('data','data','-append');
end
As size of these MAT files are inconsistent and they are in RGB file formats hence i am not sure how to tackle this matter.
Can anyone kindly guide me to resolve this issue?
  댓글 수: 6
Walter Roberson
Walter Roberson 2016년 4월 10일
The x and y values returned from the find(any(Data,3)) will never be 0.
Chathu
Chathu 2016년 4월 10일
Alright:-)

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

채택된 답변

Walter Roberson
Walter Roberson 2016년 4월 10일
xyz = [x, y];
xyz(:,3) = SliceThickness;
save('P3290190.mat', 'xyz', '-append')
  댓글 수: 1
Chathu
Chathu 2016년 4월 10일
omg,that works like a charm.
Thanks a million, Walter. I am very much grateful to you for your kindest support,it's immeasurable. Thank you once again:)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by