一个单元阵列的行方向串联

49意见(过去30天)
戴维斯
戴维斯 22 2011年12月
什么可能是一个平庸的问题,但我在用下面的麻烦道歉:
I'm writing code that involves tracking paths and filenames for 1-100 files, which I'm doing with a 2 X N (N = number of files) cell array, where the first row contains the path(s) and the second row contains the filename(s). As entries in the same column represent a single file, I need a way to concatenate every pair of entries (:,N) to assemble full paths in another cell array. Any suggestions on how best to do this (without loops, which I'm trying to avoid, unless I shouldn't be)?
谢谢!
- 戴维斯
谢谢!

答案(1)

安德烈·博布罗夫
安德烈·博布罗夫 22 2011年12月
试试这个代码,我无法测试它,现在不访问MATLAB
数据 - 您的单元阵列(规模2×N个)
OUT = arrayfun(@(I1)完整文件(数据{:,I1}),(1:大小(数据,2))”,'联合国',0);
4评论
霓虹灯Argentus
霓虹灯Argentus 20月15日
对于包含数据单元{“FILE_NAME”,“File_extention”}是NX2,则可以创建一个单一的柱细胞{“File_name.File_extention”}在NX1与
= arrayfun(@(行)[({数据行,:})],(1:大小(数据,1))”,'UniformOutput', 错误的);

登录发表评论。

s manbetx 845

社区宝藏狩猎

找到Matlab Central中的宝藏,并发现社区如何帮助您!

开始狩猎!