我在here中有很多数组要加载:
011111111111111000000000000000000000
101111000000000111111111000000000000
110100110000000110000000111111100000
111000001100000001100000110000011111
110001000011000000011000101110011100
110010000000110000000110011001110011
101000010011000001011100000001101011
101000100000101000100111001100011100
100100000110010100010011001101001010
100100001000101010011100000011110100
100010101000100010101001010110000011
100010100000011111000001100001010110
100001010110000101000011100010100101
100001001001001101100100010110101000
100000010101010010111010111000000001
011000001001110010001001001000101101
011000000111001100000110000110010011
010100100001110000110010000111000101
010100010010011001001001001010110010
010010101100001001000101101100100001
010010100110001100100010010001101100
010001110100010010010001010010001110
010001011000101011001000100101001010
010000011011100100110100110001010000
001110000001101000010011010010101010
001101000010011000001101100101000101
001011011000001100110000000011000111
001010011010010011010010010000110100
001010000110110011100100101001001000
001001101101000001001011011010010000
001001100100110100111000100100010010
000111010101000010100001000101101001
000110111000010100001110100010010001
000110010101100101001100011100000010
000101101011000010100110101000100100
000101100010101111010000011000011000
如何在MATLAB中将其转换为35 x 35矩阵?
答案 0 :(得分:1)
将所有矩阵保存在数据文件中,我们称之为data.txt
。然后将数据加载到一个巨大的矩阵:
B = arrayfun(@str2num, cell2mat( textread('data.txt','%s')))
textread
将文件读取为单元格数组cell2mat
将其转换为字符串数组arrayfun
在每个字符串上应用str2num
,将其转换为数字数组。你可以循环遍历这个巨大的矩阵并根据需要在子矩阵上剪切它。