Skip to main content

All Questions

0 votes
0 answers
44 views

Find the page in a 3D matrix that is closest to a given matrix

One can easily concatenate (stack up) four arrays by using: B = cat(3, A, A, A, A); % here A is 2-dimensional M x N matrix and B is 3-dimensional M x N x 4 stack How is it possible to concatenate (...
Crowley's user avatar
  • 2,331
3 votes
1 answer
97 views

How to make a function work with different sized meshgrid/linspace inputs

I have a a function called [U,V,W] = my_function(x,y,z) which takes grid vectors as inputs and calculates some outputs evaluated at those grid points. There are N grid points in total. The problem is ...
teeeeee's user avatar
  • 759
3 votes
1 answer
50 views

A universal algorithm for filling an array [duplicate]

I have a code and it works for 3 dimensions, but I want to be able to specify the number of dimensions dynamically. There is a function nchoosek, but it creates an array of non-repeating elements. ...
qaqos159's user avatar
3 votes
1 answer
61 views

Inserting rows into linear-indexed, collapsed matrix

Say we have an n-dimensional logical array P describing whether certain positions in an n-space are "set" or "cleared" (with respect to some attribute), and these positions are ...
Vicky's user avatar
  • 949
0 votes
1 answer
111 views

Interactive plot to change array values (MATLAB)

N = 500; pattern = zeros(N,N); grid on plot(pattern) % gets coordinates of modified cells [x,y] = ginput; % convert coordinates to integers X = uint8(x); Y = uint8(y); % convert (X,Y) into linear ...
Chris Ze Third's user avatar
0 votes
1 answer
169 views

Understanding a multidimensional array in Matlab

I have a figure and I am trying to understand it in Matlab. I = imread('frame.png'); x = I(:,:,1); y = I(:,:,2); z = I(:,:,3); In the Matlab workspace, the size of I is 480x640x3. I assume that this ...
Zizi's user avatar
  • 51
0 votes
1 answer
2k views

How to solve "Conversion to double from struct is not possible" error in Matlab

I'm trying to run the code below but I keep getting the "Conversion to double from struct is not possible" error over and over. I'd really appreciate it if you could help me with what's ...
ibrahim erkol's user avatar
1 vote
1 answer
48 views

Analog to .* for tensor/ vector multiplications in matlab

I am generalizing a 1-D numerical method to 2-D and have run into an inconvenience. I was previously scaling each row in an array by using b.*A, where b is a (nx1) vector and A is an (nxm) array. Is ...
nrs's user avatar
  • 13
1 vote
1 answer
75 views

Difference of elements of an array with all element of another array in MATLAB

Suppose I have two arrays of different sizes. Say A=[10;12;13;17;18]; and B=[20;22;23;17;26;30;32];. The output, C will be as follows: [10, 8, 7, 3, 2; 12, 10, 9, 5, 4; 13, 11, 10, 6, ...
PANKAJ DEY's user avatar
-1 votes
1 answer
49 views

Removing rows by index from arrays in matlab [duplicate]

I have an array 2500*30 elements (its type is "single") and I need to remove several rows that I know the index. For example: duplicate_ids = [1,4:8,11,859,866,1673,2157,2187,2188,2194,2195];...
Kadaj13's user avatar
  • 1,551
1 vote
1 answer
64 views

Create 3 3D arrays from 3 1D arrays in Python

I would like to find a way to mimic MATLAB's ndarray in Python (very different ndarry function!) so if I have 3 1D arrays, say i = 0:10, j = 0:11, k = 0:12, I would like to create 3 3D arrays, I, J ...
Nathan's user avatar
  • 81
3 votes
2 answers
121 views

MATLAB: Iterating through multiple double arrays to find min/max value

I'm currently trying to find the min/max value of 5 different 2x1 arrays of doubles on Matlab. I wrote a function below that works, returning the min and max values from all 5 arrays listed. However, ...
Wallace Borges's user avatar
-1 votes
1 answer
113 views

MATLAB for loop to multiple columns

I have the following block of code that I developed in MATLAB to calculate RSI. %RSI Calculation n = [14:2:18]; for i = 1:n gainC = diff(ABC).*((diff(ABC))> 0); lossC = -(diff(ABC)).*((...
daveskis's user avatar
  • 153
0 votes
0 answers
218 views

How can I convert this MATLAB cell array into a Numpy file/Python array?

This is what my variable, call it A, looks like in MATLAB (only 10 cells): Then, this is what the first cell 1,1 looks like (goes on for 20 cells): Then, this is what the first cell of that image ...
srv_77's user avatar
  • 617
4 votes
2 answers
430 views

Does MATLAB support truly 1d arrays?

It would really help me reason about my MATLAB code if I didn't have to worry about accidental 2d operations. For instance, if I want to do element-wise multiplication of 1d arrays, but one is a row ...
eric_kernfeld's user avatar

15 30 50 per page
1
2 3 4 5
14