フィルターのクリア

why my variable value become these sysbols?

1 回表示 (過去 30 日間)
JI RONG
JI RONG 2022 年 12 月 2 日
コメント済み: Les Beckham 2022 年 12 月 2 日
InfoImage = imfinfo(filename);
Width = InfoImage.Width;
Height = InfoImage.Height;
app.SizeImageEditField.Value = [Width,'x',Height];
This is my code. Thanks.

採用された回答

Les Beckham
Les Beckham 2022 年 12 月 2 日
Probably because Width and Height are not character vectors, but numeric doubles instead.
Try this:
InfoImage = imfinfo(filename);
Width = num2str(InfoImage.Width);
Height = num2str(InfoImage.Height);
app.SizeImageEditField.Value = [Width,'x',Height];
  2 件のコメント
JI RONG
JI RONG 2022 年 12 月 2 日
Thank you! Help much for me.
Les Beckham
Les Beckham 2022 年 12 月 2 日
You are quite welcome.

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

その他の回答 (1 件)

Steven Lord
Steven Lord 2022 年 12 月 2 日
When you concatenate together a char vector and a number, MATLAB does not convert the number into its character representation. It converts it into a character based on its value. From the display and some guess and check on the Unicode tables I'm guessing your image is somewhere around 1670 columns wide? I haven't tried to look for the width character.
x = 0x686
x = uint16 1670
c = char(x)
c = 'چ'
If you want to combine text data and numeric data and have the number converted to its character representation, one easy way to do that is to use a string array and the + operator (which for string arrays is concatenation.)
s = 1670 + " x " + 800
s = "1670 x 800"

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by