Error message in the console when using batch
显示 更早的评论
Im using batch, where we call the myFUN 30 times (this function procces an image)
for k=1:30
job(nn)=batch(@myFUN,1,{matfiles,k,Parameters,base_folder,saveflag,Plot_Figures},'CaptureDiary',true);
end
In that function I have an error message that tells me that this image could not be processed for some reason
fprintf(fileID,'%s Number of initial sources=0, unprocessed roi\n',Sample.TagName);
How can I make that error message appear in the console when I am using batch?
2 个评论
Raymond Norris
2025-2-21
@Sandra Martinez all good answers here.
Just to clarify, is the "error message" you're talking about the fprintf statement you're showing? That is, you want the fprintf statement to be displayed in your MATLAB console (as a pseudo error)?
Or was the call to fprintf erroring out (perhaps Sample is undefined) and you want to display the MATLAB error?
Sandra Martinez
2025-2-22
采纳的回答
更多回答(1 个)
Edric Ellis
2025-2-7
0 个投票
As mentioned by @Walter Roberson you can use the Diary property of the job to view this information. Another (more intrusive) option if you wish is to use ValueStore to record the messages. There's an example on that documentation page showing how a batch job can record progress into the ValueStore, and also how the client can register a callback function that gets called automatically whenever an entry is added to the ValueStore.
类别
在 帮助中心 和 File Exchange 中查找有关 Job and Task Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!