how to refer an element in a column to related a value in another cloumn?
2 次查看(过去 30 天)
显示 更早的评论
I have a data set as attached. 6th column represent the time. I want to find the value in the 2nd Column related to "GX" in 1st column at the time "11:49:29 " I appreciate if anyone can suggest a method for this?
Thanks in advance.
0 个评论
回答(1 个)
JESUS DAVID ARIZA ROYETH
2016-11-7
fileID = fopen('text.txt');
C = textscan(fileID,'%s %s %s %s %s %s %s','Delimiter',',');
fclose(fileID);
C=[C{:}];
value=C{and(strcmp(C(:,1),'GX'),cell2mat(cellfun(@(x) ~isempty(strfind(x,'11-49-29')),C(:,6),'UniformOutput', false))),2};
disp(value)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Licensing on Cloud Platforms 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!