フィルターのクリア

creating a matrix from different sized arrays

1 回表示 (過去 30 日間)
Michael
Michael 2012 年 5 月 15 日
Hello,
i have some test data to analyse, the data is in arrays of varying size but the names of the arrays are all similar eg; mmXXXgX (where X are numbers relating to a specific test situation)
Basically everything is taking ages to do because i can't seam to make a matrix out of it, i also don't want to cut down any of them as the amount of data varies significantly from one to the next. i was thinking about extending them with 0s but i was worried it would mess up the results if it tried to Fourier transform them.
The latest thing i have been trying involves a matrix of their names as text strings but this doesn't seem to work either.
I have never used this forum before so please let me know if i have missed anything out.
this is the code from the last attempt (it was a bit hopeful i didn't really expect it to work):
a=['mm100g0','mm155g0','mm195g0','mm215g0','mm235g0','mm295g0'
'mm100g1','mm155g1','mm195g1','mm215g1','mm235g1','mm295g1'];
peakv=zeros(size(a));
for r=1:2
for c=1:6
peakv(r,c)=fd(a(r,c));
end
end
fd() is just a function that returns a single value (the peak voltage)
Any help would be greatly appreciated, thank you
Michael

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 5 月 15 日
x = [100 155 195 215 235 295];
y = 0:1;
[ii jj] = ndgrid(y,x);
a = eval(['reshape({',sprintf('mm%dg%d,',[jj(:),ii(:)]'),'},size(jj))']);
or:
a={mm100g0,mm155g0,mm195g0,mm215g0,mm235g0,mm295g0;mm100g1,mm155g1,mm195g1,mm215g1,mm235g1,mm295g1}
% example of use
peakv = cellfun(@fd,a);

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 5 月 15 日
This should get you started, ask us for any clarifications.

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by