how to convert a character into string

75 ビュー (過去 30 日間)
Sangeetha Marikkannan
Sangeetha Marikkannan 2016 年 1 月 6 日
コメント済み: Andrew Pontius 2018 年 2 月 8 日
I read a line from notepad. It is in char. It need to be converted to string for conversion
To read a line
fid1=fopen('M:\decompiler\dct.txt','r')
C_line = fgetl(fid1)
to read a word
instruction = string(inst(14:19))
The read word is a char. I need it in string

採用された回答

Walter Roberson
Walter Roberson 2016 年 1 月 6 日
編集済み: Walter Roberson 2016 年 1 月 6 日
MATLAB strings are row vectors of characters. There is no MATLAB string data type.
  5 件のコメント
Walter Roberson
Walter Roberson 2018 年 2 月 6 日
R2016a did not have isstring() . It did have isstr()
The string data type was added in R2016b, which is when isstring() appeared. isstring() tests for the string data type, not for character vectors, so isstring('COM4') would be expected to be false because 'COM4' is a character vector rather than a string object.
MATLAB may treat serial('COM4') differently than comPort='COM4'; serial(comPort); when generating code, including possibly for MATLAB Function Block of a Simulink model. There are a number of functions where code generation requires that some of the parameters be constants rather than computed. For example code generation needs constants when what the code generation phase is doing is effectively running the function ahead of time and generating static code for the resulting array, such as can happen with building filters or communications codes. On the other hand, MATLAB Coder does not support serial() at all.
Andrew Pontius
Andrew Pontius 2018 年 2 月 8 日
Thanks for the info!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by