how to use string array in function?

hello,
I would like to know how to input string arry into vector and matrix using function?
Thanks.

5 件のコメント

Dyuman Joshi
Dyuman Joshi 2022 年 7 月 12 日
What exactly are you trying to do? Do you have any code? any error? Show us.
What you have mentioned here is quite vague to give any proper answer.
idan
idan 2022 年 7 月 12 日
I need to write function that input from the user any string arry numbers and output vecrtor and matrix that containing the string arry numbers.
Dyuman Joshi
Dyuman Joshi 2022 年 7 月 12 日
So, for example, if the input is ["12345" "2" "69"]
the output should be [12345 2 69]?
idan
idan 2022 年 7 月 12 日
yes, and also make that number into matrix and also (like you did) into vector.
Thanks
Dyuman Joshi
Dyuman Joshi 2022 年 7 月 12 日
Matrix? How? Give an example.

サインインしてコメントする。

回答 (1 件)

Prathamesh Kulkarni
Prathamesh Kulkarni 2022 年 7 月 12 日

0 投票

Hi Idan,
You can convert string array of numbers to vector by using str2double function.
A = ["34", "344", "23"]
A =
1×3 string array
"34" "344" "23"
>> B = str2double(A)
B =
34 344 23

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

質問済み:

2022 年 7 月 12 日

回答済み:

2022 年 7 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by