Easy way to copy contents of Stateflow chart to different chart?
Mostra commenti meno recenti
Hello,
I've done a search for this question without any luck. I am trying to write a Matlab script that will copy the contents of an existing Sateflow chart to another destination chart (which resides in a different model file). I cannot simply copy the entire chart block to the new model... it has to be the contents of the chart into another chart.
Originally, I was using the recommended method found here under the section "Copy Objects Individually": Copy Objects
State = OldChart.find('-isa', 'Stateflow.State');
Transition = OldChart.find('-isa', 'Stateflow.Transition');
Junction = OldChart.find('-isa', 'Stateflow.Junction');
Note = OldChart.find('-isa', 'Stateflow.Note');
Function = OldChart.find('-isa', 'Stateflow.Function');
Box = OldChart.find('-isa', 'Stateflow.Box');
AllObjects = [State; Junction; Transition; Note; Function; Box];
NewChart.view; % Need to view for pasteTo() method to work.
Clipboard.copy(AllObjects);
Clipboard.pasteTo(NewChart);
But I was getting the following error: Error using Stateflow.Clipboard/copy All objects must have the same subviewer
Using the "Copy by Grouping" greatly complicates the matter because I have the chart hierarchy below in my Stateflow chart. Things get complicated when I'm trying to differentiate between functions that were copied over within the state blocks vs. functions not in state blocks, etc...
- Top level of chart: Multiple state/function blocks subcharted and "not subcharted". State blocks are parents states.
- Within the state subcharts, I have a combination of subcharted and "not subcharted" functions/substates.
I did a test with the "Copy Objects Individually" method. I flattened my entire chart (such that nothing was subcharted) and the copying worked because everything in the chart was using the same subviewer.
Am I missing an obvious solution to my problem?
I appreciate any and all help! I'm using MATLAB 2014B
Phil
Risposte (0)
Categorie
Scopri di più su Stateflow Programmatic Interface in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!