Convert Cell Array to Num array

조회 수: 2 (최근 30일)
Chris
Chris 2011년 9월 6일
Hi, I have a table that I made in GUI, and users will input data into the table. When they prompt the push button I want it to store all of the values entered into an array that I can call for calculations. In the call back i have the following code
t = handles.manualTable;
A = get(t, 'Data')
numArray = cell2mat(get(t, 'Data'))
t gets the data A creates an array but stores each value as 'x' where x is a number. numArray creates an array but it does not allow double-digit numbers because I get the CAT argument dimension error. Any help would be greatly appreciated!! Thanks in advance
Chris
  댓글 수: 1
Fangjun Jiang
Fangjun Jiang 2011년 9월 6일
Put a break point and debug the code. Before running the 'numArray = cell2mat(get(t, 'Data'))' line, what is the value of A?

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

채택된 답변

Walter Roberson
Walter Roberson 2011년 9월 6일
numArray = str2double(get(t,'Data'));
  댓글 수: 1
Chris
Chris 2011년 9월 14일
Thank you this worked perfectly, I wqas taking my data as a cell argument instead of strings. Thanks again

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

추가 답변 (1개)

Paulo Silva
Paulo Silva 2011년 9월 6일
Maybe this is what you are looking for table in GUI to matrix, expandable array

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by