Error using save variable '...'not found
5 次查看(过去 30 天)
显示 更早的评论
Why does it keep saying "Error using save variable '...'not found?"
3 个评论
Walter Roberson
2019-6-2
When group is empty, then FullCWP_normPSD is not assigned to and so you would not be able to save it.
Stephen23
2019-6-2
Do NOT use command syntax.
Always use function syntax.
回答(1 个)
Walter Roberson
2019-6-2
编辑:Walter Roberson
2019-6-2
If you use the syntax
save FILENAME VARIABLENAME
or
save('FILENAME', 'VARIABLENAME')
then if no variable named VARIABLENAME exists in scope, you would get that error message.
For example that could happen if you think you are always computing something and so try to save it, but it turns out that there are cases where the value is not actually computed.
if V
result = 1
elseif ~V
result = 2;
end
save Output.mat result
This will not assign anything to result in some cases where V is a vector or array or is empty.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!