Skip to content

Commit

Permalink
fix: don't truncate single string names matlab vars (#487) [fix #486]
Browse files Browse the repository at this point in the history
fix bug that cause matlab variable names to be truncated to the first character.
  • Loading branch information
cdiener authored and hredestig committed Apr 11, 2017
1 parent 0154cc1 commit bd67728
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cobra/io/mat.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from numpy import object as np_object
from numpy import array, inf, isinf
from six import string_types

from cobra.core import Metabolite, Model, Reaction
from cobra.util import create_stoichiometric_matrix
Expand Down Expand Up @@ -187,7 +188,7 @@ def from_mat_struct(mat_struct, model_id=None, inf=inf):
model.id = model_id
elif "description" in m.dtype.names:
description = m["description"][0, 0][0]
if len(description) > 1:
if not isinstance(description, string_types) and len(description) > 1:
model.id = description[0]
warn("Several IDs detected, only using the first.")
else:
Expand Down

0 comments on commit bd67728

Please sign in to comment.