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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:10:29+00:00 2026-05-30T07:10:29+00:00

I have written a script in MATLAB, where I am retrieving rows and columns

  • 0

I have written a script in MATLAB, where I am retrieving rows and columns from a table based on the WHERE clause. So far i manage to retrieve the data from the database table.

The problem is that i would like to allow the user to have the option of running another search to retrieve another set of data.

This is my code so far that i have and the script is called ‘searchpdb’.

pdbSearch = input('Enter your PDB Code: ', 's')
curs = fetch(exec(conn, ['SELECT * FROM cath_2_wo_dup WHERE pdbcode = ' '''' pdbSearch '''']));
fprintf('Results Successful! \n');
results = curs.Data % prints the data out

% ----------------------
% User option to search again
% -----------------------

goAgain = input('Would you like to search for another pdb?', 's');
% if (goAgain = 'Yes')
if strcmp(goAgain, 'Yes')
    searchpdb(); %runs this script again.
elseif strcmp(goAgain, 'No')
    fprintf('\nBye!\n');

end

I have tried using ‘questdlg’, but it does not show the results of the data in the table after i have given the option to the user to run again.

I am doing this the wrong way, or is there another efficient way of doing it? Should the option of running the script again be in another script ?

  • 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-30T07:10:30+00:00Added an answer on May 30, 2026 at 7:10 am

    Well, it will work, but I would recommend using a while clause instead of calling the script recursively:

    goAgain = true;
    while goAgain
        pdbSearch = input('Enter your PDB Code: ', 's');
        curs = fetch(exec(conn, ['SELECT * FROM cath_2_wo_dup WHERE pdbcode = ' '''' pdbSearch '''']));
        fprintf('Results Successful! \n');
        results = curs.Data % prints the data out
    
        % ----------------------
        % User option to search again
        % -----------------------
    
        res = input('Would you like to search for another pdb?', 's');
        goAgain = isequal(upper(res),'YES');
    end
    

    It just becomes clearer for the reader of your code. Just by taking a look at the first lines of this new code, one can guess that:

    1. There is a loop – something happens multiple times.
    2. There is a stop condition called goAgain.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a script which is fetching data from database. Now I want
I have written a script which dynamically creates a html table based off server
I have written a script that gets data from solr for which date is
I have written a simple brainfuck interpreter in MATLAB script language. It is fed
I have written a CGI script that creates an image dynamically using GET data.
I have written a script finding the hash value from a dictionary and outputting
Hey everyone, I have written a script that downloads a zip file from a
I have little problem with printing data like this, I have written script like
I have written following script in python which works fine: from sys import argv
In Matlab (Neural Network Toolbox + Image Processing Toolbox), I have written a script

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.