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

  • Home
  • SEARCH
  • 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 8901423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:21:03+00:00 2026-06-15T01:21:03+00:00

I have a function that has 11 input parameters. MyFunction(40, 40, 1, 1, 1,

  • 0

I have a function that has 11 input parameters.

MyFunction(40, 40, 1, 1, 1, 5, 0, 1, 0, 1500, 'MyFile');

The input parameter 'MyFile' when passed through the MyFunction saves a text file using the save command that is 6 columns by the 10th input parameter of rows (e.g. 1500). I usually then load this files back into MATLAB when I am ready to analyze different runs.

I’d like to run MyFunction m times and ultimately have the 'MyFile' be a measure of central tendency (e.g. mean or median) of those m runs.

m=10
for i = 1:m;
    MyFunction(40, 40, 1, 1, 1, 5, 0, 1, 0, 1500, 'MyFile');
end;

I could use the for-loop to generate a new 'MyFile' name for each iteration (e.g. MyFile1, MyFile2,…,MyFileM) with something like MyFile = sprintf('MyFile%m'); and then load all of the MyFiles back into MATLAB and then take their average and save it as a UltimateMyFile, but this seems cumbersome. Is their a better method to average these output files more directly? Should I store the files as an object, use dlmwrite, or -append?

Thanks.

  • 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-15T01:21:04+00:00Added an answer on June 15, 2026 at 1:21 am

    since you are trying to find median, you need access to all the data.

    you can define a 3 dimension array say

    data = zeros(1500,6,m);
    

    and then at each step of for loop update it:

    data(:,:,i) = MyFunction(40, 40, 1, 1, 1, 5, 0, 1, 0, 1500);
    

    of course you will need to redefine your function to get the right output.

    However if you need to access the data at some other time, then you are better of writing it to a file and reading it from there.

    in case you are only interested in the average, you can keep a running total as each case is analyzed and then then just divide it by number of cases (m).

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

Sidebar

Related Questions

I have a type of input text that has to trigger a function on
I have a C function (composeKey) that has an input unsigned char* parameter (key).
I have a function that has a large number if individual input parameters, the
I have a stored procedure that has a bunch of input and output parameters
Suppose I have a function that has a parameter that is overloaded by many
Now I have a function that has to return a string. I saw a
I have a function that generates a key of 4 characters that has to
gcc 4.4.2 c89 I have a function that has to run (config_relays). It make
I have a function B that has this declaration: public void B(Class<? extends C>
I have a control that has a Filter property that expects a function that

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.