Can I convert a complex value vector into corresponding string?

23 ビュー (過去 30 日間)
Shafali
Shafali 2016 年 11 月 9 日
コメント済み: Shafali 2016 年 11 月 10 日
Hey I am reading character data from a text file and converting it into numeric value for further processing. After getting numeric value I performed addition operation with a complex value. Here is the sample code: f=fopen('abc.txt','r'); %open a text file y=fscanf(f,'%s'); %read the data fclose(f); w=double(y); %convert character data to corresponding double value u=w+zne; %add a complex number I just want to convert the result (u) back to its corresponding character form which I am not getting. Please help...

採用された回答

Henry Giddens
Henry Giddens 2016 年 11 月 9 日
str = num2str(u)
https://uk.mathworks.com/help/matlab/ref/num2str.html
  2 件のコメント
Shafali
Shafali 2016 年 11 月 9 日
Thanks a lot for your help...Really appreciate it.
Shafali
Shafali 2016 年 11 月 10 日
Sorry, I am troubling you guys again but I am faceing a problem while using the given solution in my code.The provided function worked for demo file as I am able to convert complex data into string. When I am using the function "num2str(u,'%s') in my code, it is giving error "Error using num2str (line 45). Input to num2str must be numeric". Please help...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by