It is relatively easy to export all the annotations in your model to a text file for others to review. After the review is done, I assume you want the modified text to be automatically loaded back to your model. This is a little tricky because there is no built-in function to link the text in your text file to the annotations in your model, with absolutely correct one-to-one match.
The key is to make sure the one-to-one match. To do that, you need to first assign your annotations a unique ID.
a=find_system(Model,'FindAll','On','Type','annotation');
for i=1:length(a)
set(a(i),'UserData',i,'UserDataPersistent','On');
end
save_system(Model);
xlswrite('ForReview.xls',[get(a,'UserData'),get(a,'Name')]);
You can give the Excel file for others to review and take the updated file back. Try not to mess up with the ID numbers.
[ID,Annotation]=xlsread('ForReview.xls');
a=find_system(Model,'FindAll','On','Type','annotation');
for i=1:size(a)
[Found,Index]=ismember(get(a(i),'UserData'),ID);
if ~Found
error('No matching ID found in text file.');
else
set(a(i),'name',Annotation(Index));
end
end
save_system(Model);
If you don't want to leave those ID, run set(a,'UserData',[]) before save_system.
Use some caution, it should be able to solve your problem.
Best Answer