将嵌套元胞数组写入 Excel 文件

问题描述 投票:0回答:1

我有一个带有嵌套单元格的变量:

hello =   
    '8'     {1x3 cell}    {1x3 cell}
    '22'    {1x3 cell}    {1x3 cell}
    '97'    {1x3 cell}    {1x3 cell}

如何使用 MATLAB 将其写入单个 Excel 文件,例如

xlswrite('file',hello)

excel matlab cell-array
1个回答
0
投票

过了一会儿才看了一下。这是我的解决方案和示例问题。

clear all; 
clc ;
d = {{'Number'},{'Class A'},{'class B'};{'007'},{'Test One'},{'Test Two'}};
for i = 1:size(d,1)
    for j = 1:size(d,2)
        if iscell(d(i,j))
            d(i,j) = d{i,j};
        end
    end
end
xlswrite('FileAddress',d);
© www.soinside.com 2019 - 2024. All rights reserved.