Skip to content

Commit

Permalink
feat: dispEM wrap text in command window
Browse files Browse the repository at this point in the history
  • Loading branch information
edkerk committed Sep 19, 2024
1 parent 99f229e commit 1439743
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions core/checkModelStruct.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ function checkModelStruct(model,throwErrors,trimWarnings)
EM = ['The following ' fieldNames{i} ' IDs start with a digit, which ' ...
'does not comply with SBML specifications. You should either ' ...
'correct this before exporting the model to SBML, or you can ' ...
' run exportModel with COBRAstyle set as true, example: ' ...
'"exportModel(model,''filename.xml'',true)"'];
'run exportModel with COBRAstyle as true, as example: ' ...
'exportModel(model, ''filename.xml'', true):, '];
dispEM(EM,throwErrors,{model.(fields{i}){numIDs}},trimWarnings);
end
catch
Expand Down
2 changes: 2 additions & 0 deletions core/dispEM.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function dispEM(string,throwErrors,toList,trimWarnings)
else
errorText=[string '\n'];
end
sz = get(0, 'CommandWindowSize');
errorText = regexprep(errorText,['.{1,' num2str(sz(1)) '}\s'],'$0\n');
if ~isempty(toList)
for i=1:numel(toList)
errorText=[errorText '\t' toList{i} '\n'];
Expand Down
4 changes: 2 additions & 2 deletions doc/core/checkModelStruct.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0239 EM = [<span class="string">'The following '</span> fieldNames{i} <span class="string">' IDs start with a digit, which '</span> <span class="keyword">...</span>
0240 <span class="string">'does not comply with SBML specifications. You should either '</span> <span class="keyword">...</span>
0241 <span class="string">'correct this before exporting the model to SBML, or you can '</span> <span class="keyword">...</span>
0242 <span class="string">' run exportModel with COBRAstyle set as true, example: '</span> <span class="keyword">...</span>
0243 <span class="string">'&quot;exportModel(model,''filename.xml'',true)&quot;'</span>];
0242 <span class="string">'run exportModel with COBRAstyle as true, as example: '</span> <span class="keyword">...</span>
0243 <span class="string">'exportModel(model, ''filename.xml'', true):, '</span>];
0244 <a href="dispEM.html" class="code" title="function dispEM(string,throwErrors,toList,trimWarnings)">dispEM</a>(EM,throwErrors,{model.(fields{i}){numIDs}},trimWarnings);
0245 <span class="keyword">end</span>
0246 <span class="keyword">catch</span>
Expand Down
28 changes: 15 additions & 13 deletions doc/core/dispEM.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,21 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0036 <span class="keyword">else</span>
0037 errorText=[string <span class="string">'\n'</span>];
0038 <span class="keyword">end</span>
0039 <span class="keyword">if</span> ~isempty(toList)
0040 <span class="keyword">for</span> i=1:numel(toList)
0041 errorText=[errorText <span class="string">'\t'</span> toList{i} <span class="string">'\n'</span>];
0042 <span class="keyword">end</span>
0043 <span class="keyword">end</span>
0044 <span class="keyword">if</span> throwErrors==false
0045 <span class="comment">%Escape special characters, required for fprintf</span>
0046 errorText=regexprep(errorText,<span class="string">'(\\|\%|'')(\\n)$'</span>,<span class="string">'\\$0'</span>);
0047 fprintf([errorText <span class="string">'\n'</span>]);
0048 <span class="keyword">else</span>
0049 throw(MException(<span class="string">''</span>,errorText));
0050 <span class="keyword">end</span>
0051 <span class="keyword">end</span></pre></div>
0039 sz = get(0, <span class="string">'CommandWindowSize'</span>);
0040 errorText = regexprep(errorText,[<span class="string">'.{1,'</span> num2str(sz(1)) <span class="string">'}\s'</span>],<span class="string">'$0\n'</span>);
0041 <span class="keyword">if</span> ~isempty(toList)
0042 <span class="keyword">for</span> i=1:numel(toList)
0043 errorText=[errorText <span class="string">'\t'</span> toList{i} <span class="string">'\n'</span>];
0044 <span class="keyword">end</span>
0045 <span class="keyword">end</span>
0046 <span class="keyword">if</span> throwErrors==false
0047 <span class="comment">%Escape special characters, required for fprintf</span>
0048 errorText=regexprep(errorText,<span class="string">'(\\|\%|'')(\\n)$'</span>,<span class="string">'\\$0'</span>);
0049 fprintf([errorText <span class="string">'\n'</span>]);
0050 <span class="keyword">else</span>
0051 throw(MException(<span class="string">''</span>,errorText));
0052 <span class="keyword">end</span>
0053 <span class="keyword">end</span></pre></div>
<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>

0 comments on commit 1439743

Please sign in to comment.