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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3349353
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3349364
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350553
Accepted Answer
2 votes
Share a link to this answer
91 Comments
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3348957
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3348960
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3349055
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3349125
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3349163
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3349184
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350318
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350319
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350347
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350397
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350398
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350450
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350493
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350505
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350522
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350532
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350552
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350559
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350562
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350563
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350564
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3350565
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351117
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351158
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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351204
- 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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351221
- 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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351286
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351290
- 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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351295
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351306
- 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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351337
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351340
- 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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351376
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351385
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351505
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351506
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351518
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351519
- 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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351543
- 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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351544
- 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
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351562
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351563
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351564
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351567
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351596
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351601
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351624
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351663
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351687
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3351698
More Answers (1)
1 vote
Share a link to this answer
4 Comments
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3348885
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3348889
Share a link to this comment
https://www.mathworks.com/matlabcentral/answers/2182631-how-to-load-data-from-octave#comment_3349352
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)