mxArray problem

Asked by dimitris on 1 Nov 2011
Latest activity Commented on by dimitris on 1 Nov 2011

In a simulink model I use a matlab function block in which i open a file(fopen), read some numbers(fscanf) and put them in an array.Then i close the file. The problem is that when i try to access the elements of the array, for example write ARRAY(1), i get the following error : "Subscripting into an mxArray is not supported."

How i will be able to have access to this array?

0 Comments

dimitris

Products

2 Answers

Answer by Kaustubha Govind on 1 Nov 2011
Accepted answer

0 Comments

Kaustubha Govind
Answer by Rajaram B S R on 1 Nov 2011

I think the problem is,

1) Data read from the file is of type mxArray and, 2) In the mex function (C coding mode) you are trying to access the contents directly.

For subscripting to be possible, you need to copy it into a local dynamically allocated array and then extract the data using mxGetChars or mxGetPr depending on the data in the file.

1 Comment

dimitris on 1 Nov 2011

I did not make it clear but i am writing matlab code and not C but thank you for your response.

Rajaram B S R

Contact us