How to convert cell 2 mat?
Afficher commentaires plus anciens
This is my code:
data03=[];
l=length(strc201603{1});
data03=zeros(l,16);
for i=1:l
data03(i,1)=day(strc201603{4}(i));
data03(i,2)=month(strc201603{4}(i));
data03(i,3)=year(strc201603{4}(i));
data03(i,4)=hour(strc201603{13}(i))+minute(C_data0{13}(i))/60+second(C_data0{13}(i))/3600;
data03(i,5)=hour(strc201603{14}(i))+minute(C_data0{14}(i))/60+second(C_data0{14}(i))/3600;
data03(i,6)=hour(strc201603{15}(i))+minute(C_data0{15}(i))/60+second(C_data0{15}(i))/3600;
data03(i,7)=hour(strc201603{16}(i))+minute(C_data0{16}(i))/60+second(C_data0{16}(i))/3600;
data03(i,8)= strc201603{17}(i);
data03(i,9)= strc201603{18}(i);
a=char(strc201603{2}(i));
a=strrep(a,'N','1');
a=strrep(a,'P','2');
a=str2num(a);
data03(i,10)=a;
b=char(strc201603{3}(i));
b=strrep(b,'Inbound','1');
b=strrep(b,'Outbound','0');
b=strrep(b,'Clockwise','3');
b=str2num(b);
data03(i,11)=b;
data03(i,12)= strc201603{6}(i);
data03(i,13)= strc201603{8}(i);
data03(i,14)= strc201603{9}(i);
data03(i,15)=strc201603{2}(i);
data03(i,16)=hour(strc201603{4}(i))*3600+minute(C_data0{4}(i))*60+second(C_data0{4}(i));
end;
I have used this code for 1 day data and it worked. But when I tried to run the code with 1 month data, the code is not working. It shows some error like:
**The following error occurred converting from cell to double:
Error using double
Conversion to double from cell is not possible.**
I couldn't understand why it shows this error. Please help.
Thanks, Faria
1 commentaire
Walter Roberson
le 29 Juin 2016
Which line is the error occurring on? What is class() and size() of all of the items mentioned on the right side of the assignment for that line? What is class() of the variable being assigned to?
Réponses (0)
Catégories
En savoir plus sur Data Type Conversion dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!