Display all rows between two ranges
显示 更早的评论
Hi,
I have to display in a table only the rows in range inputs by the user:
X = readtable('BD\prices.xlsx');
item = get(handles.edit9,'String');%get the number from user
item1 = get(handles.edit10,'String');%get the number from user
V = strcmp(X.data, item);% here its working
V1 = strcmp(X.data1, item1); % here its working
C=X(V:iV1,:); % HERE i dont know how to make the line
disp(C);
data = table2cell(C);
set(handles.uitable1, 'Data', data);
C=X(V:V1,:); % HERE i dont know how to make the line
Thanks!
1 个评论
dpb
2022-6-3
Don't re-edit the Q? to remove one issue to replace it with another -- now the answer to the original Q? I gave has no bearing on what you've left.
Restore the original content as it was.
The answer above is same thing as I noted in the previous -- the result of inrange is a logical array -- you've displayed that array which will be 0/1 being logical. It appears there's no data that satisfies -- and converting to a cell is the wrong thing to do -- instead convert the first column (why would you name the date colum "Data" instead of "Date"???) to datetime and then test it directly.
As the previous answer showed, then you need to use that logical vector to address the data or convert it to actual indices.
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!