I have 3 input manifest files, each has 137 different features name to examine which save in 'Dataset1_Permission.txt'. If it exists in the files, it is 1, if not, will be 0. I will use the 137X3 logical vector to perform some calculation as I need to find the top 10 feature names in both 3 files. Now, I have sum each feature row by row and sort them to find the top 10 maximum features that exist in both 3 files. I can find the top 10 and retrieve the location of matrix but how can I get the features name of it? I can't figure out how to do so. Below is my sample code:
function [features1] = permission(~) for app=1:3 text1 = fileread(sprintf('C:/Users/ASUS/Desktop/FYP/B%d/AndroidManifest.xml',app)); % read input manifest file
text2 = regexp(fileread('Dataset1_Permission.txt'), '\r?\n', 'split'); % read android permission list dataset
saveValue1 = []; matchStr = regexp(text1,'\"android.permission.\w*\"','match'); %extract the keyword in manifest file
saveValue1 = [saveValue1 matchStr]; no_duplicates1 = unique(saveValue1); str1 = strjoin(no_duplicates1); features1{app} = ~cellfun(@isempty,regexp(str1,text2)); disp(no_duplicates1); end for app=1:length(features1) features1{app}=features1{app}'; endfeatures1 = cell2mat(features1);total =sum(features1,2);[max_sorted,max_located] = sort( total, 'descend' );n = max_sorted(1:10);p = max_located(1:10);disp(n)disp(p) end
Best Answer