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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:31:31+00:00 2026-05-30T14:31:31+00:00

I reference an external txt file that is generated from a different program. It

  • 0

I reference an external txt file that is generated from a different program. It basically computes a volume for me within a certain area. I have to apply a correction to the volume depending on the day and thuis need t factor in a “bulking factor.”

In the command window, I can do non_pay/2 and get my answer, but running my program through editor (see % command line), I get mrdivide or rdivide errors. I don’t see how I can run the function in command window with same user input value and get an answer while in the editor, I divide by the already defined variable and received errors.

Suggestions?

%Imports the tin report data
tin = input('Enter Tin Report: ','s') ;
ref_tin = importdata(tin,' ',23);
ref = ref_tin.data;

rownum = input('Enter Row Number: ','s');

%Determines if a bulking factor is present or not
reply = input('Is there a bulking factor for this dredge area? (y/n): ', 's');
if strcmp(reply,'y')
    bulk_fctr = input('Enter Bulking Factor: ','s');
else
    bulk_fctr=1;
    disp('NO Bulking Factor')
end


%Imports conditional tin report data
[n,m] = size(ref);
cnd_tin = importdata(tin,' ',48+n);
cnd = cnd_tin.data;

%Imports tin to level data level: 52 ft
grd_tin = importdata(tin,' ',71+n*2);
grd = grd_tin.data;

%Imports tin to level data level: 53.5 ft
od_tin = importdata(tin,' ',75+n*3);
od = od_tin.data(1:n,:);

%Data to be written to production database
non_pay = round((ref(:,2)-cnd(:,2)));                  %yd^3
%non_pay2 = non_pay/bulk_fctr;
volume_removed = round((ref(:,1)-cnd(:,1))+non_pay);   %yd^3
%volume_removed2 = volume_removed./bulk_fctr;
pay_volume = round(volume_removed - non_pay);          %yd^3
area = round(ref(:,3));                                %ft^2
abv_grd = round(grd(:,1));                             %yd^3
pay_rmg = round(od(:,1));                              %yd^3

data = [volume_removed,non_pay,pay_volume,area,abv_grd,pay_rmg];
  • 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-30T14:31:33+00:00Added an answer on May 30, 2026 at 2:31 pm

    When you are asking for input for ‘Enter Bulking Factor’, you’re getting a string since you’re giving it the ‘s’ argument. Leave that out and you’ll get a value back rather than a char array.

    if strcmp(reply,'y')
        bulk_fctr = input('Enter Bulking Factor: ');
    else
        bulk_fctr=1;
        disp('NO Bulking Factor')
    end
    

    Edit to add: you should also add some checks to make sure input is valid.

    isnumeric(bulk_fctr) && isscalar(bulk_fctr)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C# code behind file that gets dynamically generated HTML from a
I'd like to reference an external configuration (e.g., *.ini) file that will allow me
Can an XML file reference two DTDs? Can a DTD reference elements from another
I am given a bunch of IDs (from an external source) that I need
I need to reference external assemblies from a dozen asp.net web sites. These assemblies
I've come up against the unlikely scenario when I reference two external assemblies that
What is the correct syntax for adding an external reference to a JavaScript file
In the below code, i am trying to reference an external .dll, which creates
I have an MXML file, which references an external script file for all its
I'm trying to step into a method referenced in an external dll from a

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.