Cell数据调取每个元素的前几位。

如图,我想取cell型数组A(在图片里)里每一个元素的前8位,然后转换成double类型放入变量B里。我输入了下面两个命令,都报错了:需要大括号或点索引表达式中的一个输出,但结果有 2797 个。
B = A{:}(1:8);
B = cellfun(@cell2mat,A{:}(1:8));
我想要的B的数据是这样子:
20060109
20060110
20060111
20060112
...
请问一下要怎么弄,谢谢!

 Akzeptierte Antwort

pxdfuxg
pxdfuxg am 21 Mai 2023

0 Stimmen

A{1,1} = '1111.mat';
A{2,1} = '2222.mat';
A{3,1} = '3333.mat';
C = cell2mat(A);
B = C(:,1:3);
这个例子应该就看懂了 加一个变量就好了

Weitere Antworten (0)

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 21 Mai 2023

Beantwortet:

am 21 Mai 2023

Community Treasure Hunt

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

Start Hunting!