f



issues involved in moving from MATLAB 5.3 (Release 11.0) to MATLAB 6.0.

Hi,
I,ve found the reason for a problem I had (and posted last week),
passing from M 5.3 to 6. In "Programming and Data Types Issues" I
found that:

"Attempting to assign a structure to a field of another structure now
results in an error if both of the following conditions are true:

The field being assigned to has been initialized to an empty matrix.
The field being assigned to is referenced in the assignment using an
array index.
For example,

mystruct.emptyfield = [];
mystruct.emptyfield(1) = struct('f1', 25);
??? Conversion to double from struct is not possible.

This operation did not return an error in previous versions of
MATLAB."

That's exacly my case. I assigned elements of a struct to one field
of another struct using a "for" iteration. I had previously created
an empty object array to put the objects created in the iteration
into. Now I have to find another way of doing that. Any suggestions?
Thanks a lot to everyone that will think about it.
By by

Sandro
0
bongano (3)
6/8/2005 1:55:04 PM
comp.soft-sys.matlab 211266 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
856 Views

Similar Articles

[PageSpeed] 15

Hi Sandro,

since you want to use a loop afterwards, just remove the first line.

Titus

"Sandro Cilacca" <bongano@hotmail.com> schrieb im Newsbeitrag 
news:ef0a10f.-1@webx.raydaftYaTP...
> Hi,
> I,ve found the reason for a problem I had (and posted last week),
> passing from M 5.3 to 6. In "Programming and Data Types Issues" I
> found that:
>
> "Attempting to assign a structure to a field of another structure now
> results in an error if both of the following conditions are true:
>
> The field being assigned to has been initialized to an empty matrix.
> The field being assigned to is referenced in the assignment using an
> array index.
> For example,
>
> mystruct.emptyfield = [];
> mystruct.emptyfield(1) = struct('f1', 25);
> ??? Conversion to double from struct is not possible.
>
> This operation did not return an error in previous versions of
> MATLAB."
>
> That's exacly my case. I assigned elements of a struct to one field
> of another struct using a "for" iteration. I had previously created
> an empty object array to put the objects created in the iteration
> into. Now I have to find another way of doing that. Any suggestions?
> Thanks a lot to everyone that will think about it.
> By by
>
> Sandro 


0
6/8/2005 2:47:48 PM
Thank you very much, Titus.

I had tried that before but still I got an error, but now, conforted
by your post, I tried to guess the reason for this new error message
and I found that I used a "class" function referring to the struct,
and AFTER this I used a "for" loop to define the structure field.
That caused en error because the code tried to add a field to the
struct after having defined a class using the struct as a template.
So I did what you suggested (remove the first line) and I also moved
this "class" line to the bottom of the code and it worked fine!
Thank you for your "simple" but illuminating suggestion, I hope I can
be useful to someone to, when I'll be more expert of Matlab.

Bye bye

Sandro

Titus Edelhofer wrote:
>
>
> Hi Sandro,
>
> since you want to use a loop afterwards, just remove the first
> line.
>
> Titus
>
> "Sandro Cilacca" <bongano@hotmail.com> schrieb im Newsbeitrag
> news:ef0a10f.-1@webx.raydaftYaTP...
>> Hi,
>> I,ve found the reason for a problem I had (and posted last
week),
>> passing from M 5.3 to 6. In "Programming and Data Types Issues"
I
>> found that:
>>
>> "Attempting to assign a structure to a field of another
structure
> now
>> results in an error if both of the following conditions are
true:
>>
>> The field being assigned to has been initialized to an empty
> matrix.
>> The field being assigned to is referenced in the assignment
using
> an
>> array index.
>> For example,
>>
>> mystruct.emptyfield = [];
>> mystruct.emptyfield(1) = struct('f1', 25);
>> ??? Conversion to double from struct is not possible.
>>
>> This operation did not return an error in previous versions of
>> MATLAB."
>>
>> That's exacly my case. I assigned elements of a struct to one
> field
>> of another struct using a "for" iteration. I had previously
> created
>> an empty object array to put the objects created in the
iteration
>> into. Now I have to find another way of doing that. Any
> suggestions?
>> Thanks a lot to everyone that will think about it.
>> By by
>>
>> Sandro
>
>
>
0
bongano (3)
6/10/2005 2:38:37 PM
Reply: