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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:42:31+00:00 2026-05-27T21:42:31+00:00

I have a problem with MATLAB that i cant quite fix. It is throwing

  • 0

I have a problem with MATLAB that i cant quite fix. It is throwing me an error, stating

??? Error using ==> fprintf
Function is not defined for 'cell' inputs.

Error in ==> writedata at 93
           fprintf(fout, 'INSERT INTO postgres VALUES( %s, %s, %s.\n )', domain, start, stop);

@Florian Brucker wrote me this code and i changed the code to run 2 regular expressions instead of one, since the one regular expression seems to copy over both of the strings in the document into one cell array when its supposed to be in two separate cell arrays.

domain = '';
start = '';
stop = '';
fin = fopen('CathDomainDescriptionFile.txt', 'r');
fout = fopen('output_cath.txt', 'w');
% TODO: Add error check!
while true
    line = fgetl(fin); % Get the next line from the file
    if ~ischar(line)
        % End of file
        break;
    end
    [key, value] = strtok(line); % Split line at the first space
    switch key
        case 'DOMAIN'
           % Store domain
           domain = value;

        case 'SRANGE'


% two regular expressions since the doing it all in one throws an error
% Index exceeds matrix dimensions.

           m = regexp(value, 'START=(\d+)', 'tokens');
           m2 = regexp(value, 'STOP=(\d+)', 'tokens');

           start = m;
           stop = m2;


           % Print result
           fprintf(fout, 'INSERT INTO postgres VALUES( %s, %s, %s.\n )', domain, start, stop);
    end
end
fclose(fin);
fclose(fout);

It seems to print out the results for the DOMAIN, but not for the START and STOP values, due to the error. It should just simply, print out the Domain number, START and STOP values inside of the fprintf statement.

I am a beginner to MATLAB.

  • 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-05-27T21:42:32+00:00Added an answer on May 27, 2026 at 9:42 pm

    You should have a look at the return type of regexp.

    In your call to fprintf you state that the input is an integer. This contradicts with the output of the regexp function called above.

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

Sidebar

Related Questions

I have problem with fancybox. I want to write a function that will run
here's my matlab problem. I need to write a matlab function that copies all
I'm using Matlab 7 and have a problem in creating a monoflop which shall
I have previous experience with MATLAB, but the problem that I face is some
Using the GUI guide editor in Matlab 2008b, I have run into a problem
I have a problem that is driving me nuts. Matlab sees only some of
I have a Binary classification problem that I need to do in MATLAB. There
I have matlab function that calls a Perl script which converts a large text
I have a problem with Matlab - I need to do the following :
I have problem in some JavaScript that I am writing where the Switch statement

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.