How do I convert table data to double to manipulate them?

조회 수: 3,489(최근 30일)
Fernando De Ita
Fernando De Ita 2017년 12월 2일
댓글: Peter Perkins 2021년 11월 8일 22:12
I extracted data from a table, when I get an element it comes as table format but when trying to make some operations like multiplication there is an error, is there any direct command or a series of steps? Can you help please
  댓글 수: 3
Peter Perkins
Peter Perkins 2021년 11월 8일 22:12
This new example goes even further into indexing and the topic of "doing math on data stored in a MATLAB table":
It's a new-for-R2021b example, but doesn't require the latest MATLAB for anything (most anything?) it covers.

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

채택된 답변

Star Strider
Star Strider 2017년 12월 2일
I would use the table2array (link) function. It will put your table into a double array, so you can do whatever you want with it then.
  댓글 수: 3
Ivania Jimenez-Lara
Ivania Jimenez-Lara 2020년 11월 3일
would you mind showing me what the code for that would look like?

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

추가 답변(3개)

Peter Perkins
Peter Perkins 2017년 12월 19일
The answer might be as simple as something like T.Z = T.x .* T.y. Without more information, hard to tell.

Roger Breton
Roger Breton 2021년 3월 8일
편집: Roger Breton 2021년 3월 8일
It does not work for me : all I want is to be able to import a range from Excel, and all I get is a "Table" on which I can't do any operation?
  댓글 수: 3
Stephen
Stephen 2021년 8월 25일
If you just need a numeric matrix, why are you importing the data as a table? Use REDAMATRIX instead.

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


Arshey Dhangekar
Arshey Dhangekar 2021년 7월 7일
Hello I have csv data of 18 columns and want to convert into double
so instead of writing 18 str2double code how can I convert all the 18 columns in short line of code
Temp.x310_Ambient__C_ = str2double (Temp.x310_Ambient__C_);
  댓글 수: 3
Peter Perkins
Peter Perkins 2021년 11월 8일 22:10
1) Post a new question, don't ask a question in a reply to someone else's question.
2) This example may be of help for the topic of "doing math on data stored in a MATLAB table":
It's a new-for-R2021b example, but doesn't require the latest MATLAB for anything (most anything?) it covers.

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

Community Treasure Hunt

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

Start Hunting!

Translated by