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)
6 ビュー (過去 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!