Respondida
Concatenate multi dimensional matrix
Your |b = cat(1, a(:, :, i))| is incorrect and is just equivalent to |b = a(:, :, i)|. If you were to use a loop you could do it...

casi 8 años hace | 1

| aceptada

Respondida
How to create a 1x12 matrix of only .
a = [1;2;3]; b = [3;2;1]; Two easy options: compose('%d.%d', a, b) %or compose("%d.%d", a, b) to get a string arr...

casi 8 años hace | 1

Respondida
How can you conform one value of one matrix to all values of another?
Assuming that the last 3 elements of the last column are a typo and are supposed to be [3; 4; 5]; [bb, aa] = ndgrid(b, a); ...

casi 8 años hace | 0

| aceptada

Respondida
How to effectively get the mean for every three consecutive outputs?
It would be useful if you used proper formatting in your question so we can see actual rows and columns. Assuming the array ...

casi 8 años hace | 1

| aceptada

Respondida
Combine times series with different length by interpolation
I would convert your tables to <https://www.mathworks.com/help/timetables.html timetables> and <https://www.mathworks.com/help/m...

casi 8 años hace | 0

Respondida
Return function the same as the inputs.
Your function makes no sense. It takes two inputs, |coef| and |knots|, and the first thing it does is discard that |knots| input...

casi 8 años hace | 0

Respondida
Use indeces of a column to sort another column
indices = str2double(A(:, 1)); B = cell(max(indices), 1); B(indices) = A(:, 2)

casi 8 años hace | 0

| aceptada

Respondida
resize and save transparent PNG file in matlab
For a start you never retrieve the transparency information so it's no wonder it's not preserved. PNG images have two ways to...

casi 8 años hace | 2

| aceptada

Respondida
For loop with Else statement
Your code is behaving exactly as expected. It may not do what you want but that's because you've made a mistake. The best way...

casi 8 años hace | 1

| aceptada

Respondida
Plotting Graph from Struct
We could have done with an explanation of what the fields of your structure actually represent. Assuming that the field |A| i...

casi 8 años hace | 2

| aceptada

Respondida
Separating Matrix by Column By Pattern?
Sounds very easy: starttime = datetime(2018, 9, 10); %whatever your start is sampletime = starttime + hours(0:size(samp...

casi 8 años hace | 0

| aceptada

Respondida
Readtable For Loop for importing large quantities of csv files in to Matlab
1. Replace x = {}; by x = cell(1, numel(file)); %better name for that variable advised. How about: tables Not...

casi 8 años hace | 1

| aceptada

Respondida
Splitting Cells Contents into A Uniform Dimension
Use a <https://www.mathworks.com/help/matlab/ref/matlab.io.text.fixedwidthimportoptions.html |FixedWidthImportOptions|> object t...

casi 8 años hace | 0

| aceptada

Respondida
Frequency of data occurrence using histc
I presume that your numbers are integer (otherwise, you're playing dangerous games using |unique| with floating point values), i...

casi 8 años hace | 0

Respondida
usage of cumprod function to write the code
cumprod([1, u-(0:n-2)]) ./ factorial(0:n-1) _edit_: actually you can replace the factorial by another cumprod which should ...

casi 8 años hace | 0

| aceptada

Respondida
how to count the number of function calls without modifying it by inserting a counter ?
Use the <https://www.mathworks.com/help/matlab/matlab_prog/profiling-for-improving-performance.html#f9-17206 Profiler> which giv...

casi 8 años hace | 2

Respondida
How to add two rows of binary elements of matrix in matlab ?
Ok, you left out a lot of necessary information in your question. In particular, that your addition is performed in the <https:/...

casi 8 años hace | 0

| aceptada

Respondida
How to select specific time frames from data?
pickups = readtable('uber.csv'); pickuphours =hour(pickups.pickup_datetime); filteredpickups = pickups(pickuphours >= 7 ...

casi 8 años hace | 1

| aceptada

Respondida
importing xml and change to mat stuct
You're making your life more complicated than you need to. You don't need to parse the file, |xml2struct| will do that for you, ...

casi 8 años hace | 0

| aceptada

Respondida
How to avoid or delete Nan values in addtion?
If I understood correctly, C = sum(cat(3, A, B), 3, 'omitnan')

casi 8 años hace | 0

Respondida
How to sum logical 1 voxels at a specific dimension?
Perhaps, this is what you want B = [ 0 0 0 0 1 0 1 1 1 0 1 0 0 ...

casi 8 años hace | 1

| aceptada

Respondida
How to generate a vector of character values?
Your question is not very clear. Note that character '1' has a value of 49. Also note that there are only 10 characters which re...

casi 8 años hace | 0

| aceptada

Respondida
Force a while loop to stop after a set number of iterarions?
counter = 0; maxiterations = 5000; while ~condition && counter < maxiterations counter = counter + 1; %... res...

casi 8 años hace | 0

| aceptada

Respondida
error in digraph while finding adjacency matrix
The optional second input argument of |adjacency| was introduced in R2018a. Since you get a |too many input arguments| error whe...

casi 8 años hace | 1

Respondida
How to import text file and sort it into arrays
Here is how I'd do it: codetoks = repmat('\s*([A-Z]{2})=([A-Z0-9]*)', 1, 33); %regexp to tokenize the 33 XX = ZZZZZ se...

casi 8 años hace | 0

| aceptada

Respondida
Why am I getting the following error?
I suspect that you modified an existing function in the mistaken belief you could replace some inputs with constants. The 2 in ...

casi 8 años hace | 0

| aceptada

Respondida
How to traverse table row based on sets
It's unclear what problem you are actually facing with Jonas' examples. As Jonas says, you can easily use any of the grouping fu...

casi 8 años hace | 1

Respondida
Scrolling through variable and looking up file
Let |seek| be you column vector of numbers, e.g.: %for demo: seek = (110:125)' %a row vector would be more practical ...

casi 8 años hace | 1

Respondida
Is there a method for finding the period of temperature data in R2007b?
_Any ideas?_ Simplest, is to upgrade to something not as ancient. Otherwise, scour the <https://www.mathworks.com/matlabce...

casi 8 años hace | 0

Respondida
Sorting Columns of a table.
If you want to sort |wx| according to the numeric values: [~, order] = sortrows(str2double(wx.EndNodes)); wx = wx(order,...

casi 8 años hace | 0

Cargar más