0

I have my cell array (89*1 cell) in Matlab that I want to convert into .Net string array (string[]). I'm using next code:

 b = NET.createArray('System.String',length(a));      
 b = NET.convertArray(a{1},'System.String');

In the result I catch next message: Conversion from 'cell' array type is not supported.

1
  • If i do: a = {'hello', 'world'}; b = NET.createArray('System.String',length(a));b = NET.convertArray(a{1},'System.String'); I get the error: Conversion from 'char' array type is not supported. Commented Dec 21, 2015 at 12:32

1 Answer 1

0

According to the documentation net.convertArray is for converting numeric data.

This seems to what you want:

a = {'hello', 'world'};
b = NET.createArray('System.String', numel(a))
for i = 1:numel(a)
    b(i) = a{i};
end

I don't know if there is a faster/easier way.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.