Skip to main content
Filter by
Sorted by
Tagged with
5 votes
2 answers
94 views

I am wondering if we can pass cell indexing as an input argument to a function, such that a cell inside the function can parse it. For example, given a cell like x = num2cell(reshape(1:24, [2,3,4])), ...
ThomasIsCoding's user avatar
2 votes
2 answers
68 views

I have a non-scalar struct array. For example S=struct; S(1).f1='a'; S(2).f1='b'; How do I add a field .f2 to S for the same value 1 efficiently? such that S becomes a struct with S(1).f2=1; S(2).f2=...
Argyll's user avatar
  • 10.1k
2 votes
3 answers
101 views

I am trying to add vertically the lists of a database like DB (see below) contained in a cell. DB={ {[11 12]} {[13 14]} {[15 16]} {[17 18]} {[19 20]}; {[21 22]} {[23 24]} {[25 26]} {[27 28]} {[...
jeanjacquesvivde's user avatar
1 vote
1 answer
492 views

I am uploading data from an Excel file which was provided in a specific format, for which a minimum reproducible example is shown below: I am trying to save each column into an array, using the ...
AmericanJael's user avatar
2 votes
2 answers
357 views

I have a cell-array in which contains some information on how to process some data, like the following: C = [ {{1 2 3} true 0 0 5 false}; ... {{2 3 4} true 0 0 3 false} ... ] How can I ...
Xoriun's user avatar
  • 180
1 vote
2 answers
183 views

I'm having trouble indexing into strings contained in a cell array using the cellfun function. I have a cell array with strings of various contents, and I'm trying to extract the numbers between the ...
Sanjo's user avatar
  • 195
0 votes
1 answer
31 views

I have the following function: function F = farray (f,N) F = {@(t) zeros(N,1)}; for i=1:N if mod(i,2)==0 F{i}=f(t); end end F = cell2mat(F); end f is a function ...
Jonathan Frutschy's user avatar
0 votes
1 answer
112 views

I did this post in Mathwork as well. But I guess I will benefit also asking it here. Here is a link to my mathwork community post. https://www.mathworks.com/matlabcentral/answers/2104821-load-save-...
Lily's user avatar
  • 1
1 vote
1 answer
61 views

I have the following: syms x; F = {3*x,2*x,x}; I would like to make F the following array G: G = [3*x,2*x,x]; To do this, I have tried this: G = double(F); and this: G = double([F{:}]).'; Neither ...
Jonathan Frutschy's user avatar
0 votes
2 answers
121 views

I understand this is a classic question and some aspects of it have been answered before, for instance here: How can I index a MATLAB array returned by a function without first assigning it to a local ...
M-G-K's user avatar
  • 11
2 votes
2 answers
122 views

In this MWE, I generate dis (x, y, z displacements for nodes and increments), I then need to extract separately the displacements clear k=0; % ignore following, this is just to buils dis for node=1:20 ...
user2260180's user avatar
1 vote
0 answers
101 views

I'm trying to use ode45 to predict the behavior of the following system: I'm getting the following error with my Force matrix F: Since the forcing function changes with time, I made it a function ...
Jonathan Frutschy's user avatar
3 votes
2 answers
130 views

I have a cell array in Matlab, with each cell representing a financial transaction as a structure object (the cell array is earlier imported from a json file). Here is an example to create a test set ...
teeeeee's user avatar
  • 785
0 votes
1 answer
56 views

I would like to create parametrized matrix with given relationship between arguments like this: B= @(A) [1*A(1), 2*A(2), 3*A(3), 4*A(4)]; But matrix is huge and cannot be created by constant ...
Ales100's user avatar
  • 195
0 votes
1 answer
44 views

I am trying to make a 2*32 cell array in matlab. The first row are the characters 'a' to 'z' , space, period, comma, exclamation Point, semicolon and quotation (32 chars). The second row must be '...
Setayesh's user avatar
0 votes
2 answers
2k views

I have this cell array >> FooCellArray FooCellArray = 1×7 cell array Columns 1 through 4 {'Foo1'} {'Foo2'} {'Foo3'} {'Foo4'} Columns 5 through 7 {'Foo5'} {'Foo6'} ...
KMC's user avatar
  • 20.1k
2 votes
2 answers
158 views

I'm trying to delete multiple consecutive and non-consecutive columns from a 80-column, 1-row cell array mycells. My question is: what's the correct indexing of a vector of columns in Matlab? What I ...
Orestes_Fox's user avatar
2 votes
1 answer
2k views

Setup: I have a 21 x 3 cell array. The first 2 columns are USUALLY strings or char arrays, but could be 1xn cells of strings or char arrays (if there are multiple alternate strings that mean the same ...
Trashman's user avatar
  • 1,664
1 vote
1 answer
160 views

I want to be able to run a loop through my current code. I have a cell array with 423 cells. Each cell is a long string of smaller strings that I am trying to separate by the delimiter (;) and I want ...
Boo's user avatar
  • 61
2 votes
1 answer
43 views

I am trying to remove the units out of a column of cell array data i.e.: cArray = time temp 2022-05-10 20:19:43 '167 °F' 2022-05-10 20:19:53 '173 °F' 2022-05-10 20:20:03 '177 °F' ......
Brian's user avatar
  • 41
1 vote
1 answer
4k views

In Matlab you can concatenate arrays by saying: a=[]; a=[a,1]; How do you do something similar with a cell array? a={}; a={a,'asd'}; The code above keeps on nesting cells within cells. I just want ...
berala's user avatar
  • 155
0 votes
2 answers
130 views

I have the following data: Names={A1 A2 B1 B2 C1 C2 C3} Doserate=(2.2 3.4 6.4 3.4 2.3 4.5 7.5) Time=(5 7.8 9 3.5 10.2 5.6 7.8) The order of Doserate and Time is such they correspond to Names. I would ...
Jan's user avatar
  • 67
0 votes
1 answer
67 views

I have a problem assigning and storing data to subfolders. I have one folder let's say a new folder, and I created 6 subfolders based on the size of a cell array. Now I want to save every element of ...
hamed majidian's user avatar
0 votes
1 answer
51 views

I have two column data, where first column contains "Number of Elements" and the second column contains "Stages" data. I want to assign the same number of data elements of "...
Ganesh's user avatar
  • 25
0 votes
2 answers
2k views

How do you append an empty array to a (non-empty) cell array? For example, starting with c={[1],[2]} desire c={[1],[2],[]} Concatenation would remove the empty array whether it is double, char or ...
Argyll's user avatar
  • 10.1k
1 vote
1 answer
345 views

I created a cell array of shape m x 2, each element of which is a matrix of shape d x d. For example like this: A = cell(8, 2); for row = 1:8 for col = 1:2 A{row, col} = rand(3, 3); ...
Lancdorr's user avatar
  • 445
1 vote
3 answers
160 views

Matlab has limitations in terms of how things can be numbered/indexed: Arrays and cell arrays require indices that are natural numbers (with exceptions that are discouraged and not more general). ...
root's user avatar
  • 2,964
1 vote
1 answer
1k views

I'm trying to create a mat file with a cell it it. I tried to apply some solutions I found on the internet but non of them worked. The code I'm wishing to have at the end is something like that: ...
MeatBALL's user avatar
1 vote
3 answers
247 views

I am working with a messy manually maintained "database" that has a column containing a string with name,value pairs. I am trying to parse the entire column with regexp to pull out the ...
skratch's user avatar
  • 33
0 votes
1 answer
109 views

I have a function I cannot change in Matlab that converts CSV file to a 1d array of chars. This is an example of what it looks like: array_o_chars = ['1' 'd' ',' ' ' 'a' 'r' 'r' 'a' 'y' '\n' 'o' 'f' ',...
mwso's user avatar
  • 128
0 votes
0 answers
310 views

I have a cell matrix with size 32x32 where each cell is an 8x8 matrix and all values are floats. I use DCT to each 8x8 cell and after that I assign each matrix to another empty cell matrix. So, the ...
mykael's user avatar
  • 21
0 votes
1 answer
1k views

I have google script for changing text in rows. Problem after text modification is that I do not know how to save array values to cells in second sheet. // Array to cells function ...
Dancul's user avatar
  • 21
0 votes
1 answer
216 views

I am looking for an equivalent of permute(A,dimorder) from Matlab, in order to convert some Matlab code to R. A loop entails a line that looks something like this: x = permute(a{i}(b(i,ii),:,:,:,:,:),[...
Steffen Schwerdtfeger's user avatar
0 votes
1 answer
76 views

I want to read a CSV File (filled in by temperature sensors) by python3. Reading CSV File into array works fine. Printing a single cell by index fails. Please help for the right line of code. This is ...
Karl's user avatar
  • 51
0 votes
2 answers
339 views

I'm trying to approximate the integral of the functions "fun_1" and "fun_2" over the given region. In the case of one single "f" it seems ok. But I want to use a vector &...
Mohammad Sd's user avatar
0 votes
0 answers
218 views

I am working in Matlab. I created a matrix and then a cell array based on that matrix: A = randi([1 5], 5, 5); B = num2cell(A); I want to replace the numbers in B with different strings based on A's ...
K_Sol's user avatar
  • 1
0 votes
1 answer
149 views

I've accumulated a list of over 10,000 text files in Octave. I've got a function which cleans up the contents of each files, normalizing things in various ways (lowercase, reducing repeated whitespace,...
S. Imp's user avatar
  • 2,877
0 votes
0 answers
64 views

Each cell is a single element (I'm not storing arrays larger than 1x1 in a cell array... I'm using a cell array to hold both numbers and characters). The cell array is 32x3822x1 and stores information ...
bme-programmer's user avatar
2 votes
2 answers
277 views

Let's say I have two simple vectors; vec1=[1,2,3]; vec2=[4,5,6]; Now I make a cell array from them. cellArray1={vec1,vec2} If I want to create a 2x3 numerical array, it is simple. [vec1;vec2] %or [...
AmirHosein Sadeghimanesh's user avatar
-1 votes
2 answers
1k views

I have problems accessing a column from a table in a cell array. I have a matlab function looking like this: function [tables, rthTables, iGateTables, lastValueTables] = dataEinlesen(~, tcoFiles) ...
goldarm5's user avatar
1 vote
1 answer
129 views

I have the following lines of code where I find an event "41" in my cell array called Events (minimal example of this array included below) and the lines of code allow me to add 8 events ...
Maheen Siddiqui's user avatar
0 votes
1 answer
169 views

I am trying to align arrays within a cell-array while prepending/postpending NaNs to match the size of arrays like this for example: %Setting up data A = [0.01 0.02 0.03 0.01 0.60 0.90 -1.02]; B = [0....
Likeunknown's user avatar
0 votes
2 answers
202 views

I tried to convert the cell x: x(1,:) = {'35,35, ,35'}; x(2,:) = {'40,40,30,40'}; x(3,:) = {'10, , ,'}; to a matrix with: R = cell2mat(cellfun(@str2num,x,'un',0)); but the outcome omits the first ...
Oliver Amundsen's user avatar
0 votes
1 answer
116 views

I am writing a code and would like to know how to pre-allocate the memory for a single cell. I understand that one can easily pre-allocate an array of cells, but this isn't what I'm looking for. My ...
pimler's user avatar
  • 61
0 votes
1 answer
382 views

I am trying to search a cell of cell arrays for a matching number (for example, 2) or string ('text'). Example for a cell: A = {1 {2; 3};4 {5 'text' 7;8 9 10}}; There is similar question. However, ...
ofey's user avatar
  • 1
0 votes
1 answer
264 views

I have a 1x234 cell array called tmp from which I want to delete all duplicates. Some elements of tmp can be: tmp{1, 3} -> 'Ro' tmp{1, 167}{1, 1} -> 'Ro' tmp{1, 167}{1, 2} -> 'CvF' Of the ...
Joesi's user avatar
  • 3
0 votes
2 answers
453 views

I am a beginner at Octave, that is why I will share something too obvious for the most. cell_arr = cell(2,2,2); cell_arr(2,2,2) = cell(2,2,2); error: =: nonconformant arguments (op1 is 2x2x2, op2 is ...
questionto42's user avatar
  • 9,962
1 vote
2 answers
1k views

I have a .mat dataset obtained from Matlab that have some data, including an 1920x1 Cell Array String stored as follow: "sample1" "sample2" "sample3" I need to import it ...
marcosautto's user avatar
0 votes
1 answer
238 views

I have the following code: N = 10; params = cell(N-3,4); step = 1; for i = 3 : N-1 % Calibrate the camera [cameraParams, imagesUsed, estimationErrors] = estimateCameraParameters(...
M_Z's user avatar
  • 201
0 votes
1 answer
160 views

I am currently working on machine learning, and as so I have an array in which the first column is the data and the second column is the label. Data was originally a cell array from Matlab (Not sure ...
Tim's user avatar
  • 3

1
2 3 4 5
21