Error using getByteStreamFromArray, Error during serialization

39 views (last 30 days)
clear all; clc; tic;
sbioloadproject PROJ.sbproj;
repeat = 1;
period = 20;
input = fix(5*rand(5,1));
for i = 1:repeat
sbioaccelerate(m1);
t = [0]; sd = [0];
for j = 1:numel(input)
cAMP_sensor_data = [];
if input(j) >= 1
m1.Parameters(12).Value = 120000;
m1.configset.StopTime = period;
[time,simdata,names] = sbiosimulate(m1);
for k = 1:size(names)
m1.Species(k).Value = simdata(end,k);
end
t = [t;t(end)+time];
cAMP_sensor_data = simdata(:,9);
sd = [sd;cAMP_sensor_data];
toc;
end
if input(j) == 0
m1.Parameters(12).Value = 0;
m1.configset.StopTime = period;
[time,simdata,names] = sbiosimulate(m1);
for k = 1:size(names)
m1.Species(k).Value = simdata(end,k);
end
t = [t;t(end)+time];
cAMP_sensor_data = simdata(:,9);
sd = [sd;cAMP_sensor_data];
toc;
end
end
figure,plot(t,sd,'m'); hold on;
title('random input');
ylim([0,((max(sd)/100)+1)*100]);
xlabel('time'); ylabel('intensity');
end
for j = 1:numel(input)
plot([j*period,j*period],[0,max(sd)],'r--');
end
SOMETIMES GOOD,EVERYTHINF IS FINE, BUT SOMETIMES RETURN THIS. BUT THE STORAGE IS FINE,THE DATA IS FINE, ONLY CANNOT PLOT. NEED HELP!!!
Warning: Error occurred while executing the listener callback for event POST_REGION defined for class matlab.internal.language.RegionEvaluator:
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
Error using getByteStreamFromArray
Error during serialization
Error in matlab.internal.editor.figure.SerializedFigureState/serialize
Error in matlab.internal.editor.FigureProxy/createWebFigureSnapshot
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager.saveSnapshot
Error in matlab.internal.editor.FigureManager.snapshotAllFigures

Answers (1)

Bala Tripura Bodapati
Bala Tripura Bodapati on 29 Sep 2022
Hi Shengjie
It is my understanding that the following error is encountered while plotting the data in Live Editor:
Error using getByteStreamFromArray
As a workaround, you can add the following command immediately after your plotting command(s):
>> uicontrol('Visible','off')
This will prevent the figure from being serialized and hence prevent the error. Note, though, that this will cause the figure to be displayed in both, Live Script and in a new figure window.

Community Treasure Hunt

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

Start Hunting!