我有以下内容的单元格:
displayop =
[2114x1 datetime] [2114x1 double] [2114x1 double] {2114x1 cell}
如何看到displayop的输出?我尝试过使用cell2mat,但是给出了以下错误:输入单元格数组的所有内容必须是相同的数据类型。
我正在查看displayop的以下输出:
03/11/2016 7544 7544' UP'
答案 0 :(得分:2)
以下是使用MATLAB表格的示例:
import requests
from bs4 import BeautifulSoup
url_pattern = 'http://agscompany.com/product-category/fittings/tube-nuts/316-tube/page/{index}/'
status_code = 200
url_index = 1
while status_code == 200:
url = url_pattern.format(index=url_index)
response = requests.get(url)
status_code = response.status_code
url_index += 1
soup = BeautifulSoup(response.content, 'html.parser')
page_items = soup.find_all('div', {'class': 'shop-item-text'})
for page_item in page_items:
print(page_item.text)
现在:
% a sample cell array resembling your data
>> displayop = {datetime(2016,3,(1:10)') (1:10)' rand(10,1) cellstr(num2str((11:20)'))}
displayop =
[10x1 datetime] [10x1 double] [10x1 double] {10x1 cell}
您仍然可以使用普通的旧单元格数组:
% convert to table, which is displayed nicely
>> table(displayop{:}, 'VariableNames',{'dt','x','y','str'})
ans =
dt x y str
___________ __ ________ ____
01-Mar-2016 1 0.049654 '11'
02-Mar-2016 2 0.90272 '12'
03-Mar-2016 3 0.94479 '13'
04-Mar-2016 4 0.49086 '14'
05-Mar-2016 5 0.48925 '15'
06-Mar-2016 6 0.33772 '16'
07-Mar-2016 7 0.90005 '17'
08-Mar-2016 8 0.36925 '18'
09-Mar-2016 9 0.1112 '19'
10-Mar-2016 10 0.78025 '20'