how to search and match

1 次查看(过去 30 天)
andrew
andrew 2013-9-9
i have 4 columns currently and I am using strfind to help find a string and print out the corresponding values . for example,
column a contains [a,b,c,d,e]
column b contains [a-1,a-2, a-3, b, c-4, c-5,...]
i would like column a to print out to the corresponding values in a, so in column a, a should be printed 3x.
how can i do this.
  4 个评论
andrew
andrew 2013-9-9
To clarify: i mean to say column 1, and column 2, and yes like you said Jan it should be cell column ['a','b','c', 'd',....]
the result should be: column 1 ['a','a','a'...] and in column 2 ['a-1','a-2',a-3'....]
Jan
Jan 2013-9-9
编辑:Jan 2013-9-9
While "['a','b','c', 'd',....]" is equivalent to 'abcd', a cell would be "{'a','b','c', 'd',....}". The curly braces are important.
Do I understand correctly, that the input data is b and you want to keep only the part left from the "-" character? Which purpose has the "column 1" then?
You wrote, that you have 4 columns, but I see a description of 2 columns only (I still write column, because I'm not sure what type and dimensions these object have).

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by