Passing char to a function?

5 次查看(过去 30 天)
Steve
Steve 2011-10-15
Hello Experts,
Consider I have function test and I am putting in char A:
test(A). How to input char without '' and inside the function to determine what char is given. After recognition to decide what sub function to do.
Thanks in advance.

采纳的回答

Jan
Jan 2011-10-15
A strange question. Perhaps:
C = 'A';
test(C)
function test(S)
if strcmp(S, 'A')
disp('This has been an A');
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by