All Questions
196
questions
0
votes
0
answers
45
views
Reshaping a 5D array to a 2D - different results in Python and Matlab
I have a 5D array of shape (5, 2, 40, 100, 32), which is a dataset. 5 and 40 refer to the number of classes and samples per each class, respectively. The correct conversion will mean that we will have ...
0
votes
1
answer
96
views
Unable to Add Column to Matrix in GNU Octave
I am writing a function, truthtable.m, into which I can input a matrix containing a series of binary inputs, and which then outputs a truth table for a function. I have a working function, binvargen.m,...
0
votes
1
answer
79
views
How do I provide dimensions of an array to be reshaped as a vector variable?
I want to reshape the array G in every iteration, and the shape for new dimensions are coming from vector (say) tensorSize. But the MATLAB reshape command does not accept the below given method,
...
0
votes
2
answers
75
views
Reshape error on Matlab I can't figure out?
Trying to add a row and column of zeroes to a user inputted matrices, can't fin any way past the reshape error
n = input ('Please Enter Desired Number of Rows:');
disp (''); ...
1
vote
0
answers
305
views
How to convert from long to wide format when the column numbers per row are variable? (MATLAB)
I have a time series dataset of accelerometry values where there are many sub-seconds of measurements but the actual number of sub-seconds recorded per second is variable.
So I would be starting with ...
0
votes
1
answer
94
views
Reshape multiple columns to cell
I have an unbalanced panel of city-year level data. After padding missing values with NaNs, I import the data as columns into matlab. For example:
city year population area
nyc ...
0
votes
1
answer
504
views
Matlab function reshape doesnt´t calculate the last dimension while trying to create a 3D image from .raw binary image file
I created binarized images by using the Otsu methode in Matlab and cut out parts of the resulting image using a function. Now i want to take a look at these images with the VolumeViewer command. I ...
0
votes
1
answer
55
views
Matlab - Reduce value by 1 until no error [closed]
I analyse data files containing different number of columns using the same program.
Each data file requires different conditions for the reshape function to work successfully. I have the following ...
1
vote
1
answer
612
views
How do I read Row Wise instead of column wise with h5py?
I have this matlab file that is of shape 70x10,000,000 (10,000,000 columns 70 rows)
Whats annoying is that when I run this line of code which is supposed to print that chunk of data,
f = h5py.File(...
0
votes
0
answers
79
views
reshape 3D to 2D and back again in matlab
I have 3D data 64X148X2466 in which I would like to reshape into 2D: 9472X2466, do some operations on, and then bring the data back to the original 64X148X2466 array. Everything I've tried mixes ...
0
votes
1
answer
1k
views
How to fix this error Index in position 2 exceeds array bounds in MATLAB?
I have a problem with this line of code bloop(rj,cj) = J1(i,j). I tried it a lot and changed the numbers, but the error remains.
The Error is Index in position 2 exceeds array bounds
bloop(rj,cj) = J1(...
0
votes
1
answer
788
views
How can I convert from cylindrical to cartesian coordinates in 3D for plotting in Matlab?
I am trying to define a function in 3D cylindrical coorindates in Matlab, and then to convert it to 3D cartesian for plotting purposes.
For example, if my function depends only on the radial ...
0
votes
0
answers
24
views
Reshape a 3D matrix to 4D matrix in MATLAB [duplicate]
I'm trying to reshape a 3D matrix into 4D. I have a 3D matrix e.g. X with dimensions mxnxf. I want a 4D matrix A, with dimensions mxnx8xk, where k=f/8.
I've tried the following using mat2cell but it ...
0
votes
1
answer
83
views
Reshape 2-D matrix with a specific format into a 3-D matrix (MATLAB)
I have a Cartesian 2-D matrix, A, that contains bins of dose values in three (X,Y,Z) dimensions;
X coordinate: from 0.0 to 50.00 cm, nx=512 bins (9.7656E-02 cm wide)
Y coordinate: from 0.0 to 50.00 ...
1
vote
1
answer
285
views
How to create a loop in a cell array and reshape matrix
I have the following script to calculate fluid perturbations.
I am reading in 2D velocity fields and then storing this data in a cell array.
In the present example i have only 4 velocity fields from ...