convert double array in array string in table
조회 수: 10 (최근 30일)
이전 댓글 표시
it's possible to convert double array in array string in table ?
T.Strategy=[Sis.Sistema].';
data=[Sis.data];%[Eq.data]; % N x size(Sis,2) array datetimes
T.DateF=data(1,:)'; % start date is first each
T.DateL=data(end,:)'; % last date is end each
[r1]=arrayfun(@(s)find(s.dailyprof,1),Sis); %trovo il primo trade
[r2]=arrayfun(@(s)find(s.dailyprof,1,'last'),Sis); %trovo ultimo trade
T.TradeF=arrayfun(@(s,i)s.data(i),Sis,r1)';
T.TradeL=arrayfun(@(s,i)s.data(i),Sis,r2)';
T.Strategy is array string.
T.DateF is array datetime
T.DateL is array datetime
T.TradeF is double array
T.TradeL is double array
댓글 수: 2
Stephen23
2023년 10월 21일
"it's possible to convert double array in array string in table ?"
Of course:
T = array2table(rand(5,2))
T = convertvars(T,'Var1','string')
답변 (1개)
Samar
2025년 1월 23일
As @Stephen23 rightly mentioned we can use the functions “array2table” and “convertvars” to convert double array and string array to a table. The links to the Documentation (assuming MATLAB R2023b release is being used) explaining the above functions is given below:
- www.mathworks.com/help/releases/R2023b/matlab/ref/array2table.html (Function: array2table)
- www.mathworks.com/help/releases/R2023b/matlab/ref/table.convertvars.html (Function: convertvars)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!