P.s : I need the extracted data in the form of a table , the way it was earlier with the same rows and selected columns.
Extracting data from a table(.mat file)
조회 수: 15 (최근 30일)
이전 댓글 표시
I have a .mat file which consist of a table( size- 19x3659). I need to extract data from it in the following pattern. Column 1-3 (Then after a gap of 128) Column 129-131 column 385-387....and so on. All the rows are to be considered.
I have no clue about this. New to MATLAB. Any help would be appreciated.
채택된 답변
Azzi Abdelmalek
2012년 7월 16일
% let us take the random matrix a, 19x3659
a=rand(19,3659);
[n,m]=size(a);b=1:m;
ind=find(and(mod(b,128)<4,mod(b,128)>0))
%check your indices 1-3 129-131 on ind, the extracted matrix result is:
result=a(:,ind)
댓글 수: 3
Khan Engr
2020년 7월 15일
Hi Azzi Abdelmalek and Abhivyakti, I read this solution, I think my problem is similar, could you please help in my question posted today that you can read on the link
Thanks
Walter Roberson
2020년 7월 15일
data = cat(1, image_patches,labels);
That code is overwriting all of data each iteration.
It looks to me as if data will not be a vector, but I do not seem to be able to locate any hellopatches() function so I cannot tell what shape it will be. As you are not doing imresize() I also cannot be sure that all of the images are the same size, so I cannot be sure that data will be the same size for each iteration. Under the circumstances you should be considering saving into a cell array.
Note: please do not post the same query multiple times. I found at least 3 copies of your query :(
추가 답변 (2개)
Image Analyst
2012년 7월 16일
편집: Image Analyst
2012년 7월 16일
Something like this (untested):
% Load mat file.
s = load(fullMatFileName);
% Extract the table. Hopefully it's a numerical array called theTable.
theTable = s.theTable;
% Get columns to extract out
[rows columns] = size(theTable);
columnsToExtract = [];
for c = 1 : 128 : (columns-3)
% Add these 3 columns.
columnsToExtract = [columnsToExtract , c, c+1, c+2];
end
% Create the new table.
newTable = theTable(:, columnsToExtract);
댓글 수: 0
Albert Yam
2012년 7월 16일
original = magic(10);
In the form of, selected = original(rows,columns);
selected = original([1:2 5 8:9] , [3 5:7])
Which is rows 1-2,5,8-9 and columns 3,5-7 play around with it. Good luck.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!