How to load data from Octave?
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
5 Comments
Share a link to this comment
Share a link to this comment
Share a link to this comment
Accepted Answer
2 votes
Share a link to this answer
91 Comments
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Unable to find file or directory "Slovenia_centered2.mat".
Error in solution>booti (line 25)
load Slovenia_centered2.mat;
Share a link to this comment
- No surprise overwrites: bare LOAD silently replaces any existing variables with the same names,
- Avoids the risk of stale variables being used from the workspace without warning,
- No magic variables: the editor/mlint won't flag x as undefined, because it can see where it came from,
- Allows easy runtime introspection via FIELDNAMES or ISFIELD,
- Self-documenting,
- Goes hand-in-hand with other good practices, e.g. providing the full path via FULLFILE, etc.
Share a link to this comment
- Is inconssistent with and won't work with existing code expecting the explicit variables without modifications to use the struct instead
- Uncommenting function line and
- Adding "end" at end of file
- Removed a bunch of extra blank lines as personal preference to shorten code in editor significantly -- immaterial other than visual.
Error in objfunEvaluator (line 5)
fval = feval(Objfun, x, self.FunArgs.AdditionalParameters{:});
Error in OptimFunctions/objectiveFirstEval (line 655)
[fval, grad, hess] = self.ObjectiveFunAndGrad(self,self.FunFcn{3},...
Error in fminunc (line 135)
[f,GRAD,HESS,funObj] = funObj.objectiveFirstEval(x);
Error in solution>booti (line 91)
[thetstar,fstar,exitflag] = fminunc(@llfn,bigtheto,options);
Error in objfunEvaluator (line 5)
fval = feval(Objfun, x, self.FunArgs.AdditionalParameters{:});
Error in OptimFunctions/objectiveFirstEval (line 655)
[fval, grad, hess] = self.ObjectiveFunAndGrad(self,self.FunFcn{3},...
Error in fminunc (line 135)
[f,GRAD,HESS,funObj] = funObj.objectiveFirstEval(x);
Share a link to this comment
Share a link to this comment
- Rename "run.m" to something that doesn't conflict with MATLAB builtin functions.
- Nobody else can run anything without the missing optimization function
- Debugging without any symptoms is impossible, you'll have to delve into the problem to see what goes wrong and why -- that's research although the error about a singular matrix is perhaps instructive as noted before.
- The code comments indicate it used a different technique in Octave than the MATLAB fminunc routine; have you used that instead? I would guess "run" is also a builtin function in Octave, too, that should not be aliased.
Share a link to this comment
- Renaming "run" into "runa" doesn't change outcome.
- I contacted dr. Röhe via email and he was kind enough to provide me the code. Trying to run his file "run" with data for France in Octave, I obtain three erorrs:
Share a link to this comment
Share a link to this comment
- I am attaching the crash report. After 60-70 minutes of running, MATLAB window closes and the small window that is attached opens. Prior to crash, thousands of errors "Matrix is singular" appear. IMPORTANT: six files, that should be the output of running "run" or "runa" in MATLAB are present in the folder! Perhaps running "runa" is successful despite the crash report? The time of creation of six files is exactly when the crash occurs.
- OK, I will ask dr. Röhe for the LLFN function and His advice what to do.
- Yes, in 2025 He told me He can run the file "run" from 2010 successfully.
- I will use debugger, okay. The instructions say I have to remove a semicolon from one line or use the Run to Here button, but I am not sure at which line. I will experiment a little.
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
- Use the values of the first column of that array as bigtheto into LLFN
- In a command session after loading the global variables, call
- llfn(bigtheto)
Share a link to this comment
- Dynare is macroeconomics software based on MATLAB, but more user-friendly. On Dynare forum they claim that singular matrix didn't crash MATLAB, there has to be other direct trigger for the hard crash. What could be this reason?
- By "bigtheto" do you mean "bigthet"? In LLFN.m file there are references to bigthet only, while in runa.m there are references to bigtheto indeed.
- The startingval.mat file has two versions. The version created by me is 20x1, ie. it has 20 rows and one column. Dr. Roehe's file has 20 rows and 2500 columns! I am not sure what column do I use.
Share a link to this comment
- The singular matrix on its own didn't, but it's immaterial to the basic problem that per your prior comment the algorithm/data is returning a set of values from each minimization iteration that then results in the singular matrix. That's the root problem; there would not be a singular matrix if the minimization routine were producing expected results -- what it's indicating to you is that there's something wrong there very early causing the problem; you need to find out what is causing that to happen; when you discover that you'll have the answer. And then, it is almost certain whatever is the eventual crash will also not occur. You and those folks are letting the crash distract focus from the real problem; it's a red herring. If you don't understand what the matrix being singular means, see the following <simply written overview> that should let you at least get a grasp on the problem. Again, what is the specific cause here is yet to be uncovered, but it's the real issue, not MATLAB having finally thrown up its hands and saying "I quit!"
- Refer to the doc for function again and function arguments. Look up "function argument association" -- it's what makes functions such a valuable programming construct. And, also re-review how fminunc works.
- Read the evaluation code -- as I've said multiple times and is clear from the code, it saves those starting values for each iteration by column. Doesn't the "2500" ring any bells when you look at the evaluation code? You don't seem to be really looking at and associating what it must mean and relating that to things like what the file content must be and how to interpret it.
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
More Answers (1)
1 vote
Share a link to this answer
4 Comments
Share a link to this comment
Share a link to this comment
Share a link to this comment
Categories
Find more on Octave in Help Center and File Exchange
Tags
See Also
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)