Coder Social home page Coder Social logo

yamlmatlab's People

Contributors

ashishtibrewal avatar jirkacigler avatar ptomask avatar

Watchers

 avatar

yamlmatlab's Issues

Fails to parse bulleted list

What steps will reproduce the problem?
1. I am using the following config file:
=== test.yaml ===
List:
- Item1
- Item2

2. I read the config file using the following command:
>> config = ReadYaml('test.yaml')

What is the expected output? What do you see instead?
I expect to see a list populated with data, instead I get this:

config = 

    List: []

What version of the product are you using? On what operating system?
I'm using version 2.2 on Ubuntu 10.04

Original issue reported on code.google.com by [email protected] on 5 May 2011 at 8:32

usecase_struct_01 fails with fresh install

What steps will reproduce the problem?
1. Download YAMLMatlab
2. Run selftest_yamlmatlab from the Tests folder
3. Observe the results in the browser

What is the expected output? What do you see instead?
Expected:
  test_WY_usecase_01: Passed
Observed:
  test_WY_usecase_01: Failed, Wrong values loaded 

What version of the product are you using? On what operating system?
I have tested this on Matlab 2013a and 2013b. More details below.

MATLAB Version: 8.2.0.701 (R2013b)
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit 
Server VM mixed mode

MATLAB Version: 8.1.0.604 (R2013a)
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 
64-Bit Server VM mixed mode

Please provide any additional information below.
I have found one difference between the original data, and the result of the 
read-write operation. By stepping inside the test_WY_Universal  for 
'usecase_struct_01' i find this:
  ry.dist{1}{33}.ZoneID is equal to {}
  data.testval.dist{1}{33}.ZoneID is equal to ''

It therefore seems that the type of empty variables may change. 
I also found another example that fails:
 a={};
 WriteYaml('~temporary.yaml',a);
 r = ReadYaml('~temporary.yaml');
  r is now equal to []

Original issue reported on code.google.com by [email protected] on 6 Dec 2013 at 8:48

Multiple formatting problems under Windows

What steps will reproduce the problem?
1. In Matlab I did the following:

a.test = magic(4)
WriteYaml('test.yml',a)

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

The valid YAML output should be in test.yml:

%YAML 1.3
test:
  - [16.0, 2.0, 3.0, 13.0]
  - [5.0, 11.0, 10.0, 8.0]
  - [9.0, 7.0, 6.0, 12.0]
  - [4.0, 14.0, 15.0, 1.0]

Rather, the script does not use windows return carriages on Window, and fails 
to indent each line correctly:

test:- [16.0, 2.0, 3.0, 13.0]- [5.0, 11.0, 10.0, 8.0]- [9.0, 7.0, 6.0, 12.0]- 
[4.0, 14.0, 15.0, 1.0]

Even after replacing the UNIX return characters with the Windows version, the 
indentation is incorrect:

test:
- [16.0, 2.0, 3.0, 13.0]
- [5.0, 11.0, 10.0, 8.0]
- [9.0, 7.0, 6.0, 12.0]
- [4.0, 14.0, 15.0, 1.0]

Also, some programs, such as OpenCV expect the file to be identified with a 
%YAML: <version> tag at the top of the file. yamlmatlab doesn't do this.

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

0.3.2, Windows 7 x64

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 21 Aug 2011 at 2:28

Support for integer

Currently if a variable is declared as integer in matlab, the exported yaml 
code will contain a float.
Changing scan_numeric function correct the problem.

%--------------------------------------------------------------------------
%
%
function result = scan_numeric(r)
    if isempty(r)
        result = java.util.ArrayList();
    elseif(isinteger(r))
        result = java.lang.Integer(r);
    else
        result = java.lang.Double(r);
    end
end

Original issue reported on code.google.com by [email protected] on 25 Oct 2013 at 7:39

data.(field) crashes when field has whitespace

What steps will reproduce the problem?
1. import any yaml file where the field names are not valid matlab field names 
(e.g. has a space)

What is the expected output? What do you see instead?
??? Invalid field name: 'file stub'.

Error in ==> Hash2Struct at 142
                    Data.(field) = d;

Error in ==> Hash2Struct at 111
                                h2sres = Hash2Struct(hm);

Error in ==> ReadYaml>ReplaceImportByStruct at 63
        s = Hash2Struct(ymlobj);

Error in ==> ReadYaml at 38
Data = ReplaceImportByStruct(yaml_file);



What version of the product are you using? On what operating system?
0.3.2; win 7; matlab 64

Please provide any additional information below.
one fix would be to use matlab's built in genvarname;  I wrote a quick 
workaround to turn spaces into _

I put this subfuction at the end of hash2struct

function field = fixFieldName(field)
%function field = fixFieldName(field)
%replaces invalid field characters (whitespaces) with underscores

ind = regexp(field, '\s');
if (~isempty(ind))
    field(ind) = '_';
end

and replaced all instances of Data.(field) with Data.(fixFieldName(field))

additionally, line 115 needs to be revised to
if isfield(Data,fixFieldName(field))


Original issue reported on code.google.com by [email protected] on 23 Jun 2011 at 2:01

Cannot read multi-document stream

What steps will reproduce the problem?
1. ReadYaml('MultiDoc.yaml');

I expected either a structured array or a cell array of yaml documents.


I am using YAMLMatlab 0.4.3 on Ubuntu 14.04 in Matlab 2015a.


My error is:
Error using ReadYamlRaw>load_yaml (line 78)
Java exception occurred:
expected a single document in the stream
 in "<string>", line 2, column 1:
    Gtype: L1L2
    ^
but found another document
 in "<string>", line 15, column 1:
    ---
    ^

    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:111)
    at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:121)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:399)

Error in ReadYamlRaw (line 42)
    result = load_yaml(filename, nosuchfileaction, treatasdata);


Error in ReadYaml (line 48)
    ry = ReadYamlRaw(filename, 0, nosuchfileaction, treatasdata);

-----
I noticed in the source code that documents are read with yaml.load() and not 
yaml.loadAll(). If I change that to loadAll, I get:

Error using ReadYamlRaw>scan (line 169)
Unknown data type: org.yaml.snakeyaml.Yaml$YamlIterable

Error in ReadYamlRaw>loadAll_yaml (line 128)
            result = scan(yaml.loadAll(fileread([filename, fileext])));

My attempts to handle the iterator before passing to scan have failed, but 
admittedly I don't know what I am doing. I'm attaching the yaml that is causing 
the error.


Original issue reported on code.google.com by [email protected] on 15 May 2015 at 4:50

Attachments:

error: YAMLMatlab:init:failed, YAMLMatlab initialization failed

What steps will reproduce the problem?
1. installing/adding the codes into the matlab path
2. executing the function InitYaml()

What is the expected output? What do you see instead?
* no output expected, just initializing the yaml.

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

Please provide any additional information below.
* windows 7, 32 bit, matlab 2009b, lama user :D


Original issue reported on code.google.com by [email protected] on 3 Mar 2011 at 11:18

index out of bounds exception when importing empty array

What steps will reproduce the problem?
1. call ReadYaml on a .yaml file containing a line with an empty array (e.g. 
'foo: []'

What is the expected output? What do you see instead?
It should create an empty array but instead it gives the following error 
message:

??? Java exception occurred:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.RangeCheck(Unknown Source)
        at java.util.ArrayList.get(Unknown Source)

Error in ==> Hash2Struct at 69
                    switch class(d.get(0))

Error in ==> ReadYaml>ReplaceImportByStruct at 63
        s = Hash2Struct(ymlobj);

Error in ==> ReadYaml at 38
Data = ReplaceImportByStruct(yaml_file);

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

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 23 Jun 2011 at 5:00

makeords doesn't correctly handle row-vectors

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 [email protected] on 29 Apr 2014 at 2:57

Attachments:

Emission of empty strings.

What steps will reproduce the problem?
1. Emission of an empty string, e.g. info: ''

What is the expected output? What do you see instead?
Expected: '' (empty string)
Actual: [] (empty list)

What version of the product are you using? On what operating system?
0.4.3 running on Windows 7

Please provide any additional information below.
Suggested solution:
function result = scan_char(r)
  if isempty(r)
    result = java.lang.String(); % result = java.util.ArrayList();
  else
    result = java.lang.String(r);
  end
end

Original issue reported on code.google.com by [email protected] on 12 Dec 2013 at 3:45

Tests will not run due to incorrect path settings.

What steps will reproduce the problem?
1. Download yamlmatlab.
2. Add it to the Matlab path as shown in the yamlmatlab instructions.
3. In the Matlab command window, type selftest_yamlmatlab(), or test_ReadYaml() 
or test_WriteYaml()

What is the expected output? What do you see instead?
An HTML report is shown.  I expected to see that yamlmatlab passed all tests.  
Instead, it showed a "crash" for every test.  

What version of the product are you using? On what operating system?
I am using YAMLMatlab_0.4.3 on OS X Mountain Lion.

Please provide any additional information below.
I used the Matlab debugger to step into test_ReadYaml.m.   
Here is the output from my command window:

>> test_ReadYaml
Testing read 
K>> PTH_PRIMITIVES()

ans =

Data/test_primitives/

K>> ReadYaml([PTH_PRIMITIVES() 'matrices.yaml'])
Error using cd
Cannot CD to Data/test_primitives (Name is nonexistent or not a directory).

Error in ReadYamlRaw>load_yaml (line 73)
            pathstore = cd(filepath);

Error in ReadYamlRaw (line 42)
    result = load_yaml(filename, nosuchfileaction, treatasdata);

Error in ReadYaml (line 48)
    ry = ReadYamlRaw(filename, 0, nosuchfileaction, treatasdata);


I found that the tests were not succeeding because the PTH_* functions were not 
returning full paths that could be used in ReadYamlRaw.  "Data/test_primitives" 
is a relative path.  Perhaps your specific setup allows this to work, but it 
does not with a fresh install on my machine.  

I changed the PTH functions from:
    function result = PTH_INHERITANCE()
      result = sprintf('Data%stest_inheritance%s',filesep,filesep);
    end
to:
    function result = PTH_INHERITANCE()
      result =    sprintf('~/Documents/MATLAB/YAMLMatlab_0/Tests/Data%stest_inheritance%s',filesep,filesep);
    end

and then selftest_yamlmatlab worked properly with all tests passing.  

Thank you,

John Boyle

Original issue reported on code.google.com by [email protected] on 9 Jul 2013 at 8:34

scan_map error: numbered map names

YamlRead('forces_1_MOD.txt') will import the 'stats' fields but none of the 
'grains'/'walls'/'contacts' fields from forces_1_MOD.txt. I get the error 
message:

Warning: Out of range or non-integer values truncated during conversion to 
character. 
> In ReadYamlRaw>scan_map at 181
  In ReadYamlRaw>scan at 118
  In ReadYamlRaw>scan_map at 186
  In ReadYamlRaw>scan at 118
  In ReadYamlRaw>load_yaml at 78
  In ReadYamlRaw at 42
  In ReadYaml at 48 

The problem is that the latter three are numbered fields; changing the field 
name to have an initial character (as in grains->g0 in the txt file) will 
correctly import that data into the struct.

I'm using yamlread on fedora with matlab 2012/3; it passes the self test. I 
tried modifying the YamlReadRaw lines where the problem occurs (in scan_map) 
but that failed. Matlab doesn't want struct names to be numerical values, but 
perhaps this restriction for map names is a yaml-wide standard?


Original issue reported on code.google.com by [email protected] on 21 Dec 2013 at 10:18

Attachments:

Problem with empty maps

What steps will reproduce the problem?
1. Try to read a legal yaml file containing an empty list such as 

--- 
{}

This creates the following error:
Output argument "result" (and maybe others) not assigned during call to
"ReadYamlRaw.m>scan_map".

Error in ReadYamlRaw>scan (line 80)
        result = scan_map(r);

Error in ReadYamlRaw>load_yaml (line 45)
            result = scan(yaml.load(fileread(filename)));

Error in ReadYamlRaw (line 19)
    result = load_yaml(filename);

Error in ReadYaml (line 17)
    ry = ReadYamlRaw(filename, 0);



What is the expected output? What do you see instead?
Expected output is an empty cell.

What version of the product are you using? On what operating system?
The latest version of yamlmatlab on Matlab 2001b, Linux

Please provide any additional information below.
I added 
result = struct();
at the top of the function result = scan_map(r), which fixed the problem.

Original issue reported on code.google.com by [email protected] on 18 Jan 2012 at 9:39

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.