Error using sprintf command
显示 更早的评论
sprintf('Iteration: %d, Sum: %d, difference: %d',a, SUMSED(a,1), diff_(a,1))
The system cannot find the path specified.
Unrecognized function or variable 'SUMSED'.
7 个评论
KSSV
2021-9-21
Use fprintf.
The error is clear, SUMSED is not defined.
Walter Roberson
2021-9-21
sprintf() is fine in this context.
If you have any "if" statements, then it possible that none of them came out true. That can especially happen if you accidentally test an entire vector instead of one element of the vector.
Nitesh Kumar Singh
2021-9-21
编辑:Walter Roberson
2021-9-21
Walter Roberson
2021-9-21
You do not assign to SUMSED anywhere in that code.
However, your variable Q appears to be a total (sum) of sed values.
KSSV
2021-9-21
It seems Q is SUMSED.
Image Analyst
2021-9-21
Why are you not using the sum(), cumsum(), and diff() functions to do this?
Nitesh Kumar Singh
2021-9-22
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!