Hello,
I am trying to use esfit feature of EasySpIn in my spectra simulation.
When I tried to entry variable feature in following way,
Vary.A = [1 3 2]
it constantly gives me this error:
'Unable to perform assignment because dot indexing is not supported
for variables of this type'
What would be the way to enter the varying parameters?
I will greatly appreciate your input
Ranjana
it sounds to me as if your Vary variable is already assigned to a type other than struct before you execute that line of code.
You could add either "clear Vary;" or "Vary = struct()"; before to remove the previous assignment.
Otherwise, please consider posting more information such that we can help based on your code - if still needed
Best wishes!
With this I can avoid situations like the variable has been assigned to something else before. Or I can also avoid having conflicting fields in one structure.
For instance, when I am assessing between gStrain and DStrain, if I don't specifically remove the structure then re-assign it but simply changing sys.gStrain to sys.DStrain. Both fields will be written in the structure and can cause error.
Meanwhile, I see people always do dot indexing. I wonder what's the pros and cons between these two methods. Is there anything that might significantly slow down the program or cause other problems? (like taking more space in the memory or those kind of issue)
The dot syntax is a bit more readable in my opinion than struct with lots of name-value arguments.
To make sure you start with an empty structure when using the dot syntax, start with Sys = struct;. This initializes Sys to an empty structure without any fields.