How to create table or matrix from these cell array in MATLAB?

조회 수: 2(최근 30일)
RAMOS UKAR
RAMOS UKAR 2022년 5월 11일
답변: Jon 2022년 5월 11일
>>GSRFeatures_58
GSRFeatures_58 =
1×58 cell array
Columns 1 through 6
{36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double}
Columns 7 through 12
{36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double}
Columns 13 through 18
{36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double}
Columns 19 through 24
{36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double}
Columns 25 through 30
{36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double}
Columns 31 through 36
{36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double}
Columns 37 through 42
{36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double}
Columns 43 through 48
{36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double}
Columns 49 through 54
{36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double} {36×31 double}
Columns 55 through 58
{36×31 double} {36×31 double} {36×31 double} {36×31 double}
>> GSRFailures_58
GSRFailures_58 =
1×58 cell array
Columns 1 through 7
{0×0 double} {0×0 double} {[13 15 27 34]} {0×0 double} {0×0 double} {0×0 double} {[16 25 34 36]}
Columns 8 through 13
{0×0 double} {[12 13 15 24 26 … ]} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
Columns 14 through 20
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
Columns 21 through 27
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
Columns 28 through 34
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
Columns 35 through 41
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
Columns 42 through 48
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
Columns 49 through 55
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
Columns 56 through 58
{0×0 double} {0×0 double} {0×0 double}

답변(2개)

Mitch Lautigar
Mitch Lautigar 2022년 5월 11일
Use a for loop, index through whichever variable you wish and grab each spot of data making sure to convert to double. This would look something like:
for i = 1:length(GSRfeatures_58)
temp = str2double(GSRfeatures_58(i));
%...implement logic here to do whatever you wish with each array
end

Jon
Jon 2022년 5월 11일
I'm not sure what you want to do with the data, but you could organize it in a table where each row is a test (or whatever the 58 elements of GSRFeatures represent). The table would have two columns the first column would hold the GSRFeatures arrays, and the second column would hold the array of failure values.
T = table(GSRFeatures_58(:),GSRFailures_58(:),'VariableNames',{'Features','Failures'}); % use (:) to make columns

Community Treasure Hunt

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

Start Hunting!

Translated by