Hello,
I want to make a typo refund if there is a user error. For example if a user types a zero or empty matrix then the output will return the same as original.
How to do it if there is an exception to "error", by typing ctrl+c.
Thanks for the helpers
clc;
clear;
sigma=input('Insert normal stresses[Mpa] and shear stresses[Mpa] of the cauchy stress tensor:');
if sigma==[] || sigma==[0 0 0;0 0 0;0 0 0]
error('The stress tensor does not exist. Please re type in the request');
end

 채택된 답변

Subhadeep Koley
Subhadeep Koley 2020년 12월 13일

0 개 추천

sigma = input('Insert normal stresses[Mpa] and shear stresses[Mpa] of the cauchy stress tensor:');
if isempty(sigma) || ~all(sigma(:))
error('The stress tensor does not exist. Please re type in the request');
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Stress and Strain에 대해 자세히 알아보기

태그

질문:

2020년 12월 13일

답변:

2020년 12월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by