Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Complicated Matrix Data filtering

조회 수: 1 (최근 30일)
Hello kity
Hello kity 2013년 1월 25일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I need to 'filter' out some data out of a large spreadsheet. The spreadsheet consists of three colomns, X Y Z , and Device name. Those values are matched with a reference, the reference is found at the end of every 'group' of data.
What I want is (for example): if device B is found in the group (this is not always the case), then do reference minus data (Xref-X , Yref-Y Zref-Z).
I select the data with:
[filename, pathname] = uigetfile({'*.xls'},'File Selector');
[num, txt]=xlsread(filename);
X Y Z Device
-11.2 151.9 0.3 A
-11.3 150.2 -0.3 A
-11.4 151.8 1.5 B
-11 151.7 0 B
-11.4 149.9 0.1 C
-11.8 151.7 1.7 D
reference -11.6 150.6 -0.2
X Y Z Device
-9.5 154.2 -0.3 A
-9.1 155.5 -1.1 A
-9.4 155.6 0.5 B
-9.4 156.5 1.2 C
-9.2 156.4 -0.2 C
reference -9.1 155.1 0.1

답변 (2개)

per isakson
per isakson 2013년 1월 26일
편집: per isakson 2013년 1월 26일
Try
[~,~,raw] = xlsread( fullfile( pathname, filename ) );

Image Analyst
Image Analyst 2013년 1월 26일
Beware that num and txt are not aligned! I'd recommend you use raw. Then use ismember() on the third column to find the desired letter, and do the math.
  댓글 수: 1
Hello kity
Hello kity 2013년 1월 29일
편집: Hello kity 2013년 1월 29일
I noticed that. I am using raw now. I can find the desired letter with strcmp. But I am having troubles how I can sort the data in groups. So DEvice A with all its (individual) values and references.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by