Getting particular number from 2 rows.

2 ビュー (過去 30 日間)
Yuan Jun Lim
Yuan Jun Lim 2019 年 10 月 30 日
回答済み: galaxy 2019 年 10 月 30 日
Hi,
I would like to get only the value 1 and 1 from first row, and value 2 and 1 from the second row.
So my output will be :
11
21
May i ask how do i do it?
Thankyou.
d.JPG

回答 (1 件)

galaxy
galaxy 2019 年 10 月 30 日
Let 's try
a = {'Scenario_1_mode_1', 'Scenario_2_mode_1', 'Scenario_3_mode_1', 'Scenario_4_mode_1'};
a = a';
for i=1:length(a)
b = regexp(a{i},'\d*','Match');
if ~isempty(b)
out(i)=str2double(strjoin(b, ''));
else
out(i)=NaN;
end
end

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by