MATLAB Answers

0

numbers and characters in same vector

Varun Sood 님이 질문을 제출함. 12 Oct 2019
최근 활동 John D'Errico 님이 답변함. 12 Oct 2019
I have a column in excel with bank account IDs which are a mix of numbers and characters:
347
345
4567bgr
345&tty
and I want to store them in a column vector, so that I can run aloop through the vector for each ID later. How can I do that?

  댓글 수: 0

로그인 to comment.

답변 수: 1

John D'Errico 님의 답변 12 Oct 2019

Store them in a cell array, actually a cell vector.
help cell
Index a cell array using curly braces, instead of parens. Thus {}, not ().
C = {'347'
'345'
'4567bgr'
'345&tty'};
C
C =
4×1 cell array
{'347' }
{'345' }
{'4567bgr'}
{'345&tty'}
C{3}
ans =
'4567bgr'

  댓글 수: 0

로그인 to comment.



Translated by