incorrect number of input arguments in imagesc

9 ビュー (過去 30 日間)
J K
J K 2019 年 6 月 2 日
コメント済み: Rena Berman 2019 年 10 月 28 日
Hi guys,
Matlab says:
Error using image
Incorrect number of arguments.
Error in imagesc (line 52)
hh = image(varargin{:}, 'CDataMapping', 'scaled');
Error in test4 (line 12)
imagesc(w, kx, ky, absolute);
And my code is on the photo. Could someone please help me correct the errors.
  1 件のコメント
Rena Berman
Rena Berman 2019 年 10 月 28 日
(Answers Dev) Restored edit

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

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 6 月 2 日
You are calling
imagesc(w, kx, ky, absolute);
Your w and kx are vectors and would be interpreted as being in the x and y position slots of the call to image() that is made. Your ky is a vector and would be interpreted as being in the C (color information) slot in the call to image(). Your absolute is a 3D array and would be interpreted as being in the clim slot in the call to imagesc() . However, imagesc() notices that the value there is not a vector of 2 elements and so does not recognize it as being intensity limits, and so just passes it as data to image(). image() then complains because it has been passed too many numeric inputs.
This is not just a matter of you needing to drop one of the inputs: image() and imagesc() and imshow() can never handle 3D volumes such as your absolute array is.
To visualize 3D arrays, you can use one of:
  • implay (view the slices as time)
  • volumeViewer() or volshow() (3D viewer)
  • slice()
  • isosurface()
  • vol3d v2 from File Exchange
  6 件のコメント
Walter Roberson
Walter Roberson 2019 年 6 月 4 日
If you have a 3D array of computed values, then slice() can extract for display. slice() uses interp3() internally
Walter Roberson
Walter Roberson 2019 年 6 月 5 日
Go back to your original code that created the 3D arrays and slice() the result.

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

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by