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 7955505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:43:40+00:00 2026-06-04T03:43:40+00:00

I’m using MATLAB to access a postgresql database. I’m running into problems trying to

  • 0

I’m using MATLAB to access a postgresql database. I’m running into problems trying to access a column of type boolean[]:

x;#% x is a <1x1 org.postgresql.jdbc4.Jdbc4Array>

When accessing real[] values, I can take the following approach:

double(x.getArray());

Unfortunately, with a boolean[] this leads to the following error message:

Undefined function 'toDouble' for input arguments of type 'logical'.

So I figured converting to logical first may work:

logical(x.getArray());

Except this doesn’t work either.

Error using logical
Conversion to logical from java.lang.Boolean[][] is not possible.

The problem may arise because java.lang.Boolean doesn’t derive from java.lang.Number, however the MATLAB docs on conversion of java return types make it seem like this shouldn’t be a problem.

Am I doing something wrong here? How do I get from the fetch result to a logical array usable in MATLAB? If all else fails, I can rebuild the tables with arrays of numeric types instead of boolean[], but it seems like this should be possible without going that far.

  • 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-04T03:43:41+00:00Added an answer on June 4, 2026 at 3:43 am

    I suspect that this is due to the difference in Java between Boolean (an object) and boolean, a primitive. Matlab conversions are really set up to handle primitives, not necessarily their associated object wrappers.

    I think that this conversion requires a loop, as follows:

    %Setup test
    b = java.lang.Boolean.FALSE;
    array = java.lang.reflect.Array.newInstance(b.getClass(), [5 6]);
    for ix1=1:length(array); 
        for ix2 = 1:(length(array(1))); 
            array(ix1, ix2)=b; 
        end; 
    end;
    %Now `array` is an initialize 2D Java array of type Boolean.
    
    %To convert to a Matlab logical array
    matArray = false(length(array), length(array(1)));  %Initialize
    for ix1=1:size(matArray, 1); 
        for ix2 = 1:size(matArray, 2); 
            matArray(ix1, ix2)=(array(ix1, ix2).booleanValue());
            %The  `booleanValue()` method converts from `Boolean` class  to `boolean` primitive
        end; 
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.