Is it possible remove a data point when the logical index removes a coordinate?
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm trying to create a scatter plot with coordinates for fixations from an excel table. Trying to create a region of interest that's a certain number of pixels big by logically removing the coordinates outside of the main area. I got a .
%step 3:filter verified saccades for only those that appear in the target areas
rawdata = readtable('RES_IAS (1).xlsx');
fix_data = rawdata(:,3:4); %extract the fixation coordinates from raw data
fix_x = table2array(fix_data(1:end,1)); %extracted X-coordinates to array
fix_y = table2array(fix_data(1:end,2)); %extracted y-coordinates to array
idx2 = fix_x > 0; fix_x < 925 %logical index for x
idx3 = fix_y > 0; fix_y < 925 %logical index for y
result1 = [fix_x(idx2) fix_y(idx3)]; %combined x and y coordinates
The code below outputs a scatterplot, I'd like to increase the filter to include a sort of border all the way around the edges (about 150 pixels)
%figure 3: fixations within ROI
x1 = fix_x(idx2)
y1 = fix_y(idx3)
figure;
scatter(x1,y1)
xlabel('X coordinates of fixations (px)'), ylabel('Y coordinates of fixations(px)'), title('Areas of fixation')
I'm aware that it's a bit redundant to have 2 indexes of the same value, but if I try to combine them into a single index like
idx2= fix_x, fix_y > 0
outputs "error:Array indices must be positive integers or logical values".
The index currently only filters a single data point at 0,0. I want to increase the size of the index, say, 95 pixels minimum, but while it removes the Y coordinates, the X-coordinates aren't removed and then I get
"Error using horzcat. Dimensions of arrays being concatenated are not consistent."
Is there a way to get both sets of values removed from the arrays? Or will it need to be edited directly from the table?
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!