画像の画素値に対して対数計算を行いたいのですが下記のようなエラーメッセージが表示されます。何がいけないのでしょうか。
>> logca1 = log(ca1)
関数 'log' の呼び出し内に、不足している引数または正しくない引数データ型がないかを確認してください

2 Kommentare

stozaki
stozaki am 17 Sep. 2020
坂本 様
以下のコマンドを実行した結果はどうなっておりますでしょうか?
cl = class(ca1)
stozaki
夏樹 坂本
夏樹 坂本 am 17 Sep. 2020
コメントありがとうございます。
コマンドを実行したところ下記のようになりました。
cl = class(ca1)
cl =
'int16'

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

stozaki
stozaki am 17 Sep. 2020
Bearbeitet: stozaki am 17 Sep. 2020

0 Stimmen

坂本様
コマンドの実行ありがとうございました。
ca1のクラスが "int16"となっています。log関数のドキュメントを見ると、入力引数のデータ型は "single" もしくは "double" となっています。従って、"int16"のデータ型は受け付けないという仕様です。
回避策としては、singleもしくはdoubleにキャストする方法は如何でしょうか?
logca1 = log(double(ca1))
どうぞ、ご検討ください。
stozaki

1 Kommentar

夏樹 坂本
夏樹 坂本 am 17 Sep. 2020
データ型を変更すると動くようになりました。アドバイスありがとうございました。

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020a

Community Treasure Hunt

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

Start Hunting!