dimensional

C: Size of two dimensional array

人盡茶涼 提交于 2019-12-03 11:41:19
I need some help counting the rows and columns of a two dimensional array. It seems like I can't count columns? #include <stdio.h> int main() { char result[10][7] = { {'1','X','2','X','2','1','1'}, {'X','1','1','2','2','1','1'}, {'X','1','1','2','2','1','1'}, {'1','X','2','X','2','2','2'}, {'1','X','1','X','1','X','2'}, {'1','X','2','X','2','1','1'}, {'1','X','2','2','1','X','1'}, {'1','X','2','X','2','1','X'}, {'1','1','1','X','2','2','1'}, {'1','X','2','X','2','1','1'} }; int row = sizeof(result) / sizeof(result[0]); int column = sizeof(result[0])/row; printf("Number of rows: %d\n", row);

MATLAB: Duplicate each element of a vector? [closed]

梦想的初衷 提交于 2019-11-28 01:44:08
I'm new to MATLAB and this website as well. I tried searching for this question, but to no avail (so I apologize if this ends up being a questions which has already been asked here before). In class, we were assigned a problem with the following description: "For an n-dimensional vector X, the function should return another 2n-dimension where each element is repeated twice. For example: if a=[2 3 4 5], after using the function, a=[2 2 3 3 4 4 5 5];" It should work with a vector of ANY random size. Your help is really appreciated! Thanks use kron : K = kron(X,Y) returns the Kronecker tensor

MATLAB: Duplicate each element of a vector? [closed]

我是研究僧i 提交于 2019-11-26 23:34:30
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm new to MATLAB and this website as well. I tried searching for this question, but to no avail (so I apologize if this ends up being a questions which has already been asked here before). In class, we were assigned a problem with the following description: "For an n-dimensional vector X, the function should