cells

Matlab: adding value into initialized nested struct-cell

故事扮演 提交于 2019-11-30 22:34:07
I have this structure Data = struct('trials',{},'time',{},'theta_des',{},'vel_des',{},'trials_number',{},'sample_numbers',{}); Data(1).trials = cell(1,trials_number); for i=1:trials_number Data.trials{i} = struct('theta',{},'pos_err',{},'vel',{},'vel_err',{},'f_uparm',{},'f_forearm',{},'m_uparm',{},'m_forearm',{},... 'current',{},'total_current',{},'control_output',{},'feedback',{},'feedforward',{},'kp',{}); end but when I want to add a value Data.trials{i}.theta = 27; I get this error... A dot name structure assignment is illegal when the structure is empty. Use a subscript on the structure.

Ploting a nested cell as a tree using treeplot: MATLAB

荒凉一梦 提交于 2019-11-30 18:41:23
问题 I have a complex cell that represents a tree structure: CellArray = {1,1,1,{1,1,1,{1,1,{1,{1 1 1 1 1 1 1 1}, 1,1}, 1,1},1,1,1},1,1,1,{1,1,1,1}}; I want to plot the representative tree from it by using treeplot(p) , but I'm not sure how to construct the array p for it to display correctly. 回答1: We can create a recursive function, which explores your cell array and creates a tree pointer array (as described in the docs) to each node's parent. This function takes a cell array (like the one in

Matlab: adding value into initialized nested struct-cell

 ̄綄美尐妖づ 提交于 2019-11-30 17:33:54
问题 I have this structure Data = struct('trials',{},'time',{},'theta_des',{},'vel_des',{},'trials_number',{},'sample_numbers',{}); Data(1).trials = cell(1,trials_number); for i=1:trials_number Data.trials{i} = struct('theta',{},'pos_err',{},'vel',{},'vel_err',{},'f_uparm',{},'f_forearm',{},'m_uparm',{},'m_forearm',{},... 'current',{},'total_current',{},'control_output',{},'feedback',{},'feedforward',{},'kp',{}); end but when I want to add a value Data.trials{i}.theta = 27; I get this error... A

Paste Mathematica code so that's it's broken into separate input cells

扶醉桌前 提交于 2019-11-30 15:25:09
问题 I often copy Mathematica code from websites (such as SO) to a notebook. The code usually gets pasted as a single input cell. I'm looking for a simple way to paste it as several input cells for convenient step-by-step evaluation. For example, a = 2; f[x_] := x^a Plot[f[x], {x,0,2}] would ideally paste as two input cells. Manual formatting (i.e. the original newlines) should preferably also be preserved (this is not the case with default pasting). Generally, if one selects all input cells (ALT

How can I disable editing cells in a WPF Datagrid?

余生长醉 提交于 2019-11-29 23:25:12
I'm constructing a datagrid in Windows Presentation Foundation, and I have a problem. When a user double-clicks on a cell in my datagrid, the cell goes into edit mode. I want to prevent that. Instead I want users to be able to select the full row - not edit values in it. How can I make it so that double-clicks select the full row instead of putting the clicked-on cell in edit mode? Leslie Davies The WPF DataGrid has an IsReadOnly property that you can set to True to ensure that users cannot edit your DataGrid 's cells. You can also set this value for individual columns in your DataGrid as

C# -- 使用Aspose.Cells创建和读取Excel文件

≡放荡痞女 提交于 2019-11-29 11:26:44
使用Aspose.Cells创建和读取Excel文件 1. 创建Excel 1 Aspose.Cells.License li = new Aspose.Cells.License(); 2 li.SetLicense("Aspose.Cells.lic"); 3 Aspose.Cells.Workbook wk = new Aspose.Cells.Workbook(); 4 Worksheet ws = wk.Worksheets[0]; 5 for (int i = 0; i < 9; i++) 6 { 7 for (int j = 0; j < 9; j++) 8 { 9 ws.Cells.Rows[i][j].Value = (i + 1) + "*" + (j + 1) + "=" + (i + 1) * (j + 1); 10 } 11 } 12 wk.Save("d:\\zzz\\d.xls"); 13 Console.WriteLine("ok"); 14 Console.ReadKey(); 产生的Excel文件: 2.读取Excel 1 DataTable dt = new DataTable(); 2 Aspose.Cells.License li = new Aspose.Cells.License(); 3 li.SetLicense("Aspose

How can I disable editing cells in a WPF Datagrid?

。_饼干妹妹 提交于 2019-11-28 20:41:35
问题 I'm constructing a datagrid in Windows Presentation Foundation, and I have a problem. When a user double-clicks on a cell in my datagrid, the cell goes into edit mode. I want to prevent that. Instead I want users to be able to select the full row - not edit values in it. How can I make it so that double-clicks select the full row instead of putting the clicked-on cell in edit mode? 回答1: The WPF DataGrid has an IsReadOnly property that you can set to True to ensure that users cannot edit your

dequeueReusableCellWithIdentifier behavior changed for prototype cells?

别等时光非礼了梦想. 提交于 2019-11-28 07:22:30
问题 In iOS5, using ARC and prototype cells for tableView on storyboard, can I replace the code below: static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } // Configure the cell... return cell; With this simple code??: UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];

Excel转DataTable

柔情痞子 提交于 2019-11-28 00:34:04
public static DataTable ExcelToDatatable(string filepath, bool flag = false, int startRow = 1) { Workbook workbook = null; using (FileStream file = new FileStream(filepath, FileMode.Open, FileAccess.Read)) { workbook = new Workbook(file); } var cells = workbook.Worksheets[0].Cells; DataTable dt = new DataTable(); int rowIndex = 0; if (flag) { rowIndex = startRow; } bool d = true;//防止表头重复加载 for (int i = rowIndex; i < cells.MaxDataRow + 1; i++) { if (!d && string.IsNullOrWhiteSpace(cells[i + 1, 0].StringValue.Trim())) { continue; } DataRow row = dt.NewRow(); for (int j = 0; j < cells