How do I get a cell array or character array with more than one row into VB?

How do I get a cell array or character array with more than one row into VB?
The MATLAB reference I added to my project had GetCharArray but this doesn't seem to work. I get error messages saying 'more than one row' or 'type mismatch' if I do not have just 1 row.

 Accepted Answer

The GetCharArray Function returns a single dimension string, thus it will not be able to return a multi-dimensional string array.
The workaround is to:
1. create two strings
2. concatenate them with a new line appended in between.
Note: Make sure your text box property is set to MULTILINE.
Below is a code snippet illustrating this:
Matlab.Execute ("a = ['Hello'; 'World']")
'Break it up into two pices
Matlab.Execute ("a1 = a(1,:)")
Matlab.Execute ("a2 = a(2,:)")
'Chr$(13) & Chr$(10) defines the newline character
Text1.Text = Matlab.GetCharArray("a1", "base") & Chr$(13) & Chr$(10) &
Matlab.GetCharArray("a2", "base")

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!