Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:37:45+00:00 2026-06-07T14:37:45+00:00

The following code produces the error: Warning: Dimensions of AlphaData must be 1×1, or

  • 0

The following code produces the error:

Warning: Dimensions of AlphaData must be 1×1, or must match CData.

The problem is that CData is a color image and thus has 3 dimensions, and alphadata is a matrix of transparancy data abd thus has 2 dimensions.

red = cat(3, ones(512), zeros(512), zeros(512));
mask = [];
bounds = data(currow,1:6);
if slice >= bounds(5) && slice <= bounds(6)
    mask = zeros(size(segmask,1),size(segmask,2));
    mask(bounds(1)-4:bounds(2)+4,bounds(4)+4:bounds(4)+5) = 1;
    mask(bounds(2)+4:bounds(2)+5,bounds(3)-4:bounds(4)+4) = 1;
end
imshow(low(:,:,slice),[WL-WW/2 WL+WW/2])
hold on
h = imshow(red);
set(h, 'AlphaData', 0.3*mask);
hold off

Here is the info on AlphaData and CData from the Matlab Documentation


AlphaData m-by-n matrix of double or uint8

Transparency data. A matrix of non-NaN values specifying the
transparency of each face or vertex of the object. The AlphaData can
be of class double or uint8.

MATLAB software determines the transparency in one of the following
ways:

Using the elements of AlphaData as transparency values
(AlphaDataMapping set to none)

Using the elements of AlphaData as indices into the current alphamap
(AlphaDataMapping set to direct)

Scaling the elements of AlphaData to range between the minimum and
maximum values of the axes ALim property (AlphaDataMapping set to
scaled, the default)


CData
matrix | m-by-n-by-3 array

The image data. A matrix or 3-D array of values specifying the color
of each rectangular area defining the image. image(C) assigns the
values of C to CData. MATLAB determines the coloring of the image in
one of three ways:

Using the elements of CData as indices into the current colormap (the
default) (CDataMapping set to direct)

Scaling the elements of CData to range between the values
min(get(gca,’CLim’)) and max(get(gca,’CLim’)) (CDataMapping set to
scaled)

Interpreting the elements of CData directly as RGB values (true color
specification)

Note that the behavior of NaNs in image CData is not defined. See the
image AlphaData property for information on using transparency with
images.


How Can AlphaData and CData possibly have the smae dimensions?

In case red is 512x512x3 and mask is 512×512 and besides the warning the code seems to function as expected.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:37:48+00:00Added an answer on June 7, 2026 at 2:37 pm

    I figured out my problem. Because of the If statement the variable mask wasnt allays being created.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When uploading a file from iPhone, my code produces the following error: Warning: move_uploaded_file()
The following code produces no suitable constructor found error. I am unable to figure
Can anyone tell me why the following code produces the alert box that I
I have the following code that produces a background image in a table cell.
Given the following code: var a = 'somegarbage=http://somesite.com/foo/bar/&moregarbage'; var result = a.match(/http.+\//g); Produces the
The following code produces an error, any ideas why? string dateFormatString = dd.MM.yyyy HH:mm:ss;
The following code produces an error. dbo.getit works fine when I call it directly
I am getting the following error while running the code, Warning: require_once(product.php) [function.require-once]: failed
The following code produces error: ImageIcon i=new ImageIcon(logo.png); Image scaleImage=i.getImage().getScaledInstance(10,10,Image.SCALE_DEFAULT); mainPanel.add(scaleImage); The error is
The following code produces the compiler error Expression expected (Sub is underlined). Dim lambda

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.