Hi, so my problem is the followed, I save every variable that is going to change with the loop into another variable using:
All_Horas{q} = Horas;
The Problem I got is that it saves like its shown in the image and I would like it directly with the number.
How could I do it. All this stuff it is because I want to use this variables to do an hystogram

 채택된 답변

Cris LaPierre
Cris LaPierre 2022년 2월 16일

0 개 추천

Try using parentheses instead of curly braces.
All_Horas(q) = Horas;

댓글 수: 6

flashpode
flashpode 2022년 2월 16일
It wored to me but for the variables that are double it gives me error:
Conversion to cell from double is not possible.
Do I have to save it as before and then change to double or is there something else I could do
Cris LaPierre
Cris LaPierre 2022년 2월 16일
I think you need to share more of your code for us to know what is going on.
flashpode
flashpode 2022년 2월 16일
Conversion to cell from double is not possible. That is the error I got
Error in NewCode (line 70)
All_PpH(q) = PpH;
If I use All_PpH{q} = PpH; I do not have problem but is saved as cell and I want to keep it as double.
Cris LaPierre
Cris LaPierre 2022년 2월 16일
I understand the error message. The request is for you to share your code.
This is the code where it is all generated:
Total_Dist=cell(1,NumLat1);
for i = 1:1:NumLat1
loc1 = [lat1(i),lon1(i)];
loc2 = [41.3828 2.1857];
[Dist] = haversine(loc1,loc2);
Total_Dist{i} = Dist;
end
Td = cell2mat(Total_Dist);
[TD,index_TD] = maxk(Td,100);
D_1 = TD(1);
D_100 = TD(100);
index_TD = index_TD([1,100]);
%%Calculamos el promedio de cada hora:
PpH = mean(Td);
Cris LaPierre
Cris LaPierre 2022년 2월 16일
I don't see All_Horas(q) = Horas;

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2022년 2월 16일

댓글:

2022년 2월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by