write number next to each other + return value 0/1
Afficher commentaires plus anciens
Hello,

i have a tablehave imported from Excel.
In the ID column I want the values from hod + min + s + CasVSekundach but as text so that it doesn't add up for me (T.ID = (T.hod) + (T.min) + (T.s). It should look like in the first column: not 25 but 002525(h/min/s/CasVSekundach).
And I want to create a new column (ID_H), where the distance from the column according to criterion> 5 returns 0 and if = <5 returns 1
I try ID_H=(ID(ID>5)=1), but it doesn´t works...
Thank you for any help.
1 commentaire
ILoveMATLAB
le 14 Juin 2022
Modifié(e) : ILoveMATLAB
le 15 Juin 2022
For your first question.
- Convert each column of intrest to an array of strings. sCol1 =strings(T.hod)
- Concatenate all the strings arrays using the + operator T.ID = sCol1 + sCol2+ sCol3
For your second question
ID_H = double(ID>5);
Réponse acceptée
Plus de réponses (1)
ILoveMATLAB
le 15 Juin 2022
Modifié(e) : ILoveMATLAB
le 15 Juin 2022
(Forgot to submit as an anwser)
For your first question.
- Convert each column of interest to an array of strings. sCol1 =strings(T.hod)
- Concatenate all the strings arrays using the + operator T.ID = sCol1 + sCol2+ sCol3
For your second question
ID_H = double(ID>5);
4 commentaires
Zuzana Pániková
le 15 Juin 2022
ILoveMATLAB
le 16 Juin 2022
I don't understand what your doing. What is odstup? You need to define the odstup variable.
%Try this
ID_H = double(T.ID>5);
%Or this
ID = T.ID
ID_H = double(ID>5);
Walter Roberson
le 16 Juin 2022
O = T.odstup
Zuzana Pániková
le 17 Juin 2022
Catégories
En savoir plus sur MATLAB 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!