Converting disp answers to vector/str2num

I have code line that goes as such. It displays all the answers from earlier part of the code's for loop iterations and I would like to use str2num to convert the disp answers to a matrix. However, there is an error "too many input arguments". Is there another way I can use str2num with disp, or another function similar to disp, just that its form is in a vector? Thank you!
disp (find(A))

댓글 수: 4

Jesus Sanchez
Jesus Sanchez 2019년 12월 1일
Could you clarify? Do you want to show the data stored in a matrix or do you want to save your data in a matrix?
Cside
Cside 2019년 12월 1일
I would like to show data - im assuming display the data, in a vector. the for loop in my code runs 10 loops, and disp currently displays 10 find(A) in a chunk but I would like them separate in a vector each
Can you provide an example of A. Also, why do you need to display all the indices of A, I suspect disp(numel(A)), or disp(size(A)) would be preferable.
Jesus Sanchez
Jesus Sanchez 2019년 12월 1일
Then, as Kalyan answered, fprintf is a good option for your problem. Good luck! :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

질문:

2019년 12월 1일

댓글:

2019년 12월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by