Error using containers.Map
Mostrar comentarios más antiguos
Hello, I am having following problem. I want to display single cells from my string array if my function finds a specific string. Here is the code:
function voddi_test(graph)
global vodcode
system_name = extract_system_name(graph);
variables = containers.Map();
variable = containers.Map();
keys = variables.keys;
for name = variables.keys
variable(name{1}) = true;
end
for node_name = filter_graph(graph, 'Variable', true)
node = graph(node_name{1});
for arg = node.arguments
variables([system_name '/' arg{1}]) = true;
end
end
for keys = 1:numel(variables)
if strcmp(variables(keys), 'Constant')
variables(keys{1})
else
variables(keys{2})
end
end
end
I am keeping getting the error message "Specified key type does not match the type expected for this container" when I try compare the content of the variables map with my desired strings. The code works fine, expect for the last for - loop. Any help is much appreciated, many thanks.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 30 de Nov. de 2016
0 votos
You create variables as an empty map. It has no keys. So your first for loop does nothing so no keys are created for variable
1 comentario
jungdnb
el 1 de Dic. de 2016
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!