How can I find time in decimal?

1 visualización (últimos 30 días)
Saad Alqahtani
Saad Alqahtani el 1 de Sept. de 2020
Respondida: Star Strider el 1 de Sept. de 2020
Hello,
I'm trying to find time points in decimals but I keep getting this error:
Unable to perform assignment because the left and right sides have a different
number of elements.
Error in hold_9_1_20_CUT_trial (line 274)
c(2) = calcEnd;
here is my code:
calcStart =find(time==25);
calcEnd = find(time==30.23);
c(1)= calcStart;
c(2) = calcEnd;
The code works if I for expample I changed the calcEnd = find(time==30.23); to be 30.25 or 30.5 but not 30.23 or 3.72
Any help would be apprecitated

Respuestas (1)

Star Strider
Star Strider el 1 de Sept. de 2020
Since it is not certain if ‘time’ is a row or column vector, the most robust option would be:
c{1} = calcStart;
c{2} = calcEnd;
creating them as cell arrays. Use cell array indexing or the cell2mat function to recover them later.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by