Info

この質問は閉じられています。 編集または回答するには再度開いてください。

could anyone help me how to split different set of numbers sepaartely

7 ビュー (過去 30 日間)
jaah navi
jaah navi 2018 年 9 月 6 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
i am having three different sets of numbers displayed in the same line as the output say for example {1} {2 3} {4}.Could anyone please help me how to split it in three different lines inorder to get the output as 1 2 3 4

回答 (2 件)

KSSV
KSSV 2018 年 9 月 6 日
A = [{1} {2 3} {4}] ;
B = cell2mat(A)
  7 件のコメント
KSSV
KSSV 2018 年 9 月 6 日
How you are getting it? Can you tell me what does class(data) shows?
jaah navi
jaah navi 2018 年 9 月 6 日
i am making use of partition
C = partitions(3)
home
partdisp(C).
If i run it gives
The 5 partitions of set {1 2 3}:
{1 2 3}
{1 2} {3}
{1 3} {2}
{1} {2 3}
{1} {2} {3}

Shannon Cherry
Shannon Cherry 2018 年 9 月 6 日
Try this for your duplicate question on how to remove set bracket
regexprep(C, '\{(.*)\}', '$1')
  2 件のコメント
jaah navi
jaah navi 2018 年 9 月 6 日
It gives error stating Error using regexprep All cells must be strings.
Shannon Cherry
Shannon Cherry 2018 年 9 月 6 日
input = '{1 2 3}'
output = regexprep(input, '\{(.*)\}', '$1')
This is working for me.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by