Saving Structure leads to error "Index exceeds matrix dimensions." - crash

I have two different structures (DATA and orient). They both are build up like this: DATA.S(1).M(1).A(1).var1 etc...
When I want to save them with the following lines:
text='data1';
filename=strcat('save/',text,'.mat');
save(filename, 'DATA', 'orient');
I get the error "Index exceeds matrix dimensions." for the save line.
When I stop the Programm before the line and try to save it manually over the Workspace matlab is crashing but using all the processing power.
I'm using MAtlab R2014a an the structs are between 2000-4000Bytes.
I hope anyone has a idea what it could be about. Thanks for your help!

Ok, I found a solution. I simply used the following code(http://www.mathworks.com/matlabcentral/fileexchange/39721-save-mat-files-more-quickly/content/savefast.m) from Tim Holy. Now it works without any problems. Thanks Tim Holy!!! :)

Related

Error in seq.default(from, to, by) : invalid '(to - from)/by ggpattern

I'm using geom_bar_pattern to try to put stripes in an stacked barplot. I could run the command once, but I'm trying to do it again and it doesn't work. The error is Error in seq.default(from, to, by) : invalid '(to - from)/by'
I received the same error and realized that this was due to the limited size of my screen. I was able to see the figure and resolve the error by expanding the built-in plot viewer...
I just got the same error message with geom_bar_pattern. In my case it was entirely a matter of spacing in the plot: I had a long string of text for one axis ticks. When I reduced that, I immediately got rid of the issue!
Not sure if it's the same situation in your case, but I thought I'd answer just in case this could help...
Good luck!

can not get a same solution from SNOPT when I try to solve a Nonlinear Program in Drake with a same initial guess

I am trying to solve a nonlinear program with Direct collocation in drake. I want to regain the solution when SNOPT solved the program successfully. First I saved the initial guess of each variable in a .txt file, then I read the initial guess and set decision variables by SetInitialGuess() , and change nothing else, but I did not get the same solution, WHY?
MOREOVER, when I run more times, the latter solutions are same.
e.g.
solution1 != solution2; solution2 == solution3; solution3 == solution4;.....
I have check each initial guess to make sure they are same. Is there options in SNOPT or initial settings in NP should be set beside the initial guess of decision variables to get a same solution?
Without knowing more about your program, one possible reason is that when you save the initial guess to a.txt, the floating number get truncated when print it to a txt file. So in the second run, the initial guess is not exactly the same as the first run. And this tiny difference in the initial guess causes the SNOPT to find a different solution. For solution 2, 3, 4, do they all load the initial guess from a.txt?
In order to print the floating number to the txt file, you could use setprecision command.

CreateML data analysis stopped

When I attempt to train a CreateML model, I get the following screen after inputting my training data:
Create ML error message
I am then unable to add my test data or train the model. Any ideas on what is going on here?
[EDIT] As mentioned in my comment below, this issue went away when I removed some of my training data. Any newcomers who are running into this issue are encouraged to try some of the solutions below and comment on whether it worked for them. I'm happy to accept an answer if it seems like it's working for people.
This happens when the first picture in the dataset has no label. If you place a labeled photo as the first in the dataset and in the coreML json, you shouldn't get that issue.
Correct:
[{"annotations":[{"label":"Enemy","coordinates":{"y":156,"x":302,"width":26,"height":55}}],"imagefilename":"Enemy1.png"},{"annotations":[{"label":"Enemy","coordinates":{"y":213,"x":300,"width":69,"height":171}}],"imagefilename":"Enemy7.png"},{"annotations":
Incorrect:
[{"annotations":[],"imagefilename":"Enemy_v40.png"},{"annotations":[],"imagefilename":"Enemy_v41.png"},{"annotations":[],"imagefilename":"Enemy_v42.png"},{"annotations":
At the minimum you should check for these 2 situations, which triggered the same generic error for me (data analysis stopped), in the context of an Object Detection Model:
One or more of the image names referenced in annotations.json is incorrect (e.g. typo in image name)
The first entry in annotations.json has an empty annotations array (i.e. an image that does not contain any of the objects to be detected)
If you are using any random Split or something similar, make sure, its parsing the data correctly. you can test this easily by debugging.
I suggest you check to see if your training data is consistent and all entries have all needed values. The error is likely in the section of data you removed.
That would cause the error Nate commented he is seeing when he gets that pop up.
Getting the log would be the next step in any other evaluation.

Imported text data to variable?

I have a little problem while creating my UWP program using VB.
I'm downloading text file that has coordinates. And what I would need that every of those is a variable that later I can count.
X Y
231.15 154.65
574.89 123.78
257.15 468.98
487.87 789.97
531.15 124.65
524.89 223.78
657.15 668.98
347.87 389.97
I don't have any idea where to start. Any clues?
It's hard to say where to start since your question seems pretty sparse on details, but if you're considering making all of those variables, consider using a two-dimensional array instead. It'll save you a lot of effort and make your application run faster.

local variable referenced before assignment frequently occurring error

Hello I've done multiple python programs since I started and an error is occurring quite often for a short time and I don't understand why there is an error or why by just changing random things so the program does the same gets rid of it so can anybody please explain how the "referenced before assignment" error occurs please.
Here's the code with the problem:
def compter(sequence, element):
comtpe=0
for i in sequence:
if element==sequence[i]:
compte+=1
return compte
compter([1,2,1,1], 1)
please explain so I could be able to get rid of it in any future code thank you very much :)
(I'musing python 2.7.6)