fprintf of multidimensional cell arrays

1 view (last 30 days)
I am working on an export script to extract requirements references from my model to a simple XML file that I then post process using perl. the requirements references are simple text added as annotations to a block within the locality of the functionality. The script works until I have multiple requirements referenced on one annotation on separate lines. The problem seems to stem from the return of a cell array (1x3).
Here is the script:
% code
reqrefs = find_system('Regexp','on','AttributesFormatString','m:');
reqtxt = get_param(reqrefs,'AttributesFormatString');
reqstr = 'm:([0-9]+\.[A-Z]+\.[A-Z]+\.[0-9]+\.v[0-9]+)';
reqs = regexp(reqtxt,reqstr,'match');
fileID = fopen('~reqrefs.txt','wt');
for i = 1:length(reqrefs)
sys(i).reqxref = reqs{i};
sys(i).location = reqrefs(i);
The output from the script is in the attached file. At line 32 you can see how the multi-lined annotation is output to the file. Can anyone help me change my fprintf statement to handle to the cell array correctly?
  1 Comment
Jamie Wardlaw
Jamie Wardlaw on 4 Dec 2013
Coming back to this with fresh eyes I found the solution, my for loop has been changed to parse the cell array as follows
if true
% code
for i = 1:length(reqrefs)
reqids = reqs{i};
for col=1:ncols
The text is now correctly extracted from the model on multi-lines of the annotation.

Sign in to comment.

Accepted Answer

Jamie Wardlaw
Jamie Wardlaw on 4 Dec 2013
My answer is above

More Answers (0)


Find more on Dependency Analysis in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!