Hello, i have a little problem with my function.
Below is my function,
A=input('Input the components of a vector, separated by spaces or commas:\n','s');
vector=str2num(A);
fprintf('you entered %d\n',vector)
MATLAB gives me this results. (Let's take 1,2,3 as the example for vector)
you entered 1
you entered 2
you entered 3
you entered 4
I want the results to appear like this instead
you entered 1 2 3 4
Is there any way in doing that or there is something wrong with my function?
Thanks in advance

 채택된 답변

Walter Roberson
Walter Roberson 2015년 11월 20일

0 개 추천

fprintf('you entered');
fprintf(' %d',vector);
fprintf('\n');

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

질문:

2015년 11월 20일

답변:

2015년 11월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by