liangzimei / yamlmatlab

Automatically exported from code.google.com/p/yamlmatlab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

makeords doesn't correctly handle row-vectors

GoogleCodeExporter opened this issue · comments

Conversion from cell-array to matrix (using makeords=1) fails for row-vectors.

What steps will reproduce the problem?

1.  Execute this code

Test 1:
>> reference = [1,2];
>> WriteYaml('test.yaml', struct('test', reference)); 
>> tmp = ReadYaml('test.yaml',1,1);
>> test=tmp.test;
>> isequal(reference, test)

Test 2:
Or simpler, read a file containing this text:

test: [1,2]


What is the expected output? What do you see instead?

Test 1: Should return true, but returns false.
Test 2: "test" field should contain [1,2] but contains {[1], [2]}.

What version of the product are you using? On what operating system?

YAMLMatlab Version 0.4.3
Matlab 8.1.0.604 (R2013a)
OSX Mavericks

Please provide any additional information below.

The code in makematrices.m>iter_cell() assumes a cell array of cell arrays, but 
in the case of row vectors, it's just a cell array of scalars.  I have attached 
a patch for makematrices.m which I believe fixes this issue.


Original issue reported on code.google.com by KyleSi...@gmail.com on 29 Apr 2014 at 2:57

Attachments:

Original patch file was missing a semicolon; attached revised patch.

Original comment by KyleSi...@gmail.com on 29 Apr 2014 at 4:06

Attachments: