Filter löschen
Filter löschen

dbhole.mat contains 334 files and each file contains data of[2xn]. I want that how many 'h'(i.e h1,h2 etc) are in each 'd' (i.e d1,d2, etc)

1 Ansicht (letzte 30 Tage)
for example, for d1, it has total 20h(d1h1,d1h2...d1h20). how to index out all the'h'in d1,d2...d14

Antworten (2)

Andrei Bobrov
Andrei Bobrov am 1 Jul. 2016
Bearbeitet: Andrei Bobrov am 1 Jul. 2016
clear
load dbhole
a = whos;
n0 = {a.name}';
x = regexp(n0,'\d*','match');
x = x(~cellfun(@isempty,x));
x = cat(1,x{:});
z = sortrows(str2double(x));
[aa,~,c] = unique(z(:,1));
out = [aa, accumarray(c,1)];

Stalin Samuel
Stalin Samuel am 30 Jun. 2016
Below approach may solve your problem
load dbhole
nfile = struct2cell(whos)
ret = nfile(1,1:end)
Refer regexp which will be useful for you

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by