Search data in a dataset array

I have a dataset array which contains doubles and strings and I would like to search by variable names(columns) the intersection between two of this columns. I have try with the following code, where cond1 is a double and cond2 a string, result_test is the dataset array.
list1 = find(result_test.Temp, cond1)% find the value cond1 in column Temp
list2 = find(result_test.Chip, cond2)% find the value cond2 in column Chip
result_data = intersect (list1, list2)%%find intersection
But I got the next problem:
Undefined function 'find' for input arguments of type 'cell'.
I think the problem is a mistmacth between the data to find and the content on the dataset.
I would really graceful if somebody could help me, thank you in advance.

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 7 月 23 日

0 投票

Use
list1 = find(strcmp(result_test.Temp, cond1))

3 件のコメント

Manuel
Manuel 2013 年 7 月 23 日
This case works perfectly when the content of the cell in the dataset is a string, but in case that the content is an integer y tried to convert but I was not succesfull... any idea?
Thanks again!
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 7 月 23 日
For double use
list1 = find(cell2mat(result_test.Temp)==cond1))
Manuel
Manuel 2013 年 7 月 23 日
Thank you very much! It works.

サインインしてコメントする。

その他の回答 (1 件)

David Sanchez
David Sanchez 2013 年 7 月 23 日

0 投票

by the error message you get, it seems you are trying to apply find to a cell array, which can not be done. Make sure your data comes in the right form before applying find.

カテゴリ

ヘルプ センター および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by