Input string to a matrix or a cell
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a string and want to input it to a matrix or a cell.
string: name
matrix: A(2,3)
cell: data{2}(2,4);
Could you help?
采纳的回答
per isakson
2016-7-10
编辑:per isakson
2016-7-10
Cell array
>> data = cell( 1, 3 );
>> data{2} = cell(3,6);
>> data{2}{2,4} = 'Hello World';
or
>> data{2}(2,4) = {'Hello World'};
With a Matrix it is not practical. "A(2,3)" would address one character.
3 个评论
per isakson
2016-7-10
- Have you thought of using Create and Work with Tables? (Introduced in R2013b)
- See Access Data in a Cell Array
- and by the way, see The XY Problem
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!