Answered

How to store a matrix, A, in variable X, where X is also carrying a counter "i"

Simple way: add a third dimension, "pages": X(:,:,i) = A; But, if you only need the last iteration, it's better to store jus...

How to store a matrix, A, in variable X, where X is also carrying a counter "i"

Simple way: add a third dimension, "pages": X(:,:,i) = A; But, if you only need the last iteration, it's better to store jus...

2 dagen ago | 0

Answered

Permutations of array retaining sub-array groups together

I believe the best way to describe your arrays-with-subgroups is using cell arrays: my_array = {1 [2 3] 4} my_array = {...

Permutations of array retaining sub-array groups together

I believe the best way to describe your arrays-with-subgroups is using cell arrays: my_array = {1 [2 3] 4} my_array = {...

5 dagen ago | 0

Answered

Does MATLAB have functionality similar to Mathematica's Import function to import html tables?

check out htmlTableToCell on the file exchange, followed by cell2table

Does MATLAB have functionality similar to Mathematica's Import function to import html tables?

check out htmlTableToCell on the file exchange, followed by cell2table

5 dagen ago | 0

| accepted

Answered

Random shuffle of image pixels/ Image scrambling

You can use randperm to shuffle the indices randomly, then sort to get the indices for reversing it: % load in an image include...

Random shuffle of image pixels/ Image scrambling

You can use randperm to shuffle the indices randomly, then sort to get the indices for reversing it: % load in an image include...

9 dagen ago | 0

Answered

Nested loops and function output into a matrix inconsistency

It seems like your 'w' columns are supposed to correspond to q-r pairs. Currently, this isn't happening, so each q-r pair will f...

Nested loops and function output into a matrix inconsistency

It seems like your 'w' columns are supposed to correspond to q-r pairs. Currently, this isn't happening, so each q-r pair will f...

9 dagen ago | 0

| accepted

Answered

How to write special characters into an Excel cell?

If you can find the numeric code for the symbols, it should print with that. For example, this prints π | ϕ | μmol/kg T1.Proper...

How to write special characters into an Excel cell?

If you can find the numeric code for the symbols, it should print with that. For example, this prints π | ϕ | μmol/kg T1.Proper...

30 dagen ago | 0

| accepted

Answered

Adding a unit row to a table

% create example table T = array2table(magic(3),"VariableNames",["a";"b";"c"]); % define units T.Properties.VariableUnits = [...

Adding a unit row to a table

% create example table T = array2table(magic(3),"VariableNames",["a";"b";"c"]); % define units T.Properties.VariableUnits = [...

ongeveer een maand ago | 0

| accepted

Answered

Changing empty array for peak width to zero

% preallocate default values pks1 = nan(25,1); loc1 = nan(25,1); width1 = zeros(25,1); prom1 = nan(25,1); for i=1:25 [...

Changing empty array for peak width to zero

% preallocate default values pks1 = nan(25,1); loc1 = nan(25,1); width1 = zeros(25,1); prom1 = nan(25,1); for i=1:25 [...

ongeveer een maand ago | 0

Answered

How to select matrix column from minimum row value

distance_to_point = [2, 3, 4, 5; 6.8, 2.9, 6.1, 6.7] [~,idx] = min(distance_to_point(2,:)); new_point = distance_to_point(:,id...

How to select matrix column from minimum row value

distance_to_point = [2, 3, 4, 5; 6.8, 2.9, 6.1, 6.7] [~,idx] = min(distance_to_point(2,:)); new_point = distance_to_point(:,id...

ongeveer een maand ago | 0

| accepted

Answered

Aquire random sampling of plot values

Assuming your two datasets share x values and are not absurdly massive, this direct method is probably faster % generate some s...

Aquire random sampling of plot values

Assuming your two datasets share x values and are not absurdly massive, this direct method is probably faster % generate some s...

ongeveer 2 maanden ago | 0

Answered

How is parfor time taken is larger than that by normal for loop ?

Best guess: you don't preallocate y, nor clear it. So, the parfor needs to expand the vector constantly while the for is simply ...

How is parfor time taken is larger than that by normal for loop ?

Best guess: you don't preallocate y, nor clear it. So, the parfor needs to expand the vector constantly while the for is simply ...

2 maanden ago | 0

Answered

How to obtain hourly average from several years of data

G = groupsummary(struct2table(WSHelp),'DateTime','hour','mean');

How to obtain hourly average from several years of data

G = groupsummary(struct2table(WSHelp),'DateTime','hour','mean');

2 maanden ago | 0

| accepted

Answered

how to split these char format into lines

ed: Matlab has a built-in function w_split = splitlines(w); Here's a trick: I don't know what the delimiter between lines ...

how to split these char format into lines

ed: Matlab has a built-in function w_split = splitlines(w); Here's a trick: I don't know what the delimiter between lines ...

2 maanden ago | 0

| accepted

Answered

Adding fields and values to a structure iteratively

n=3; priors=struct(); for ind=1:n priors.("prior"+ind) = makedist('uniform',-1,1); end

Adding fields and values to a structure iteratively

n=3; priors=struct(); for ind=1:n priors.("prior"+ind) = makedist('uniform',-1,1); end

2 maanden ago | 0

| accepted

Answered

How to copy data from multiple .mat files into single .mat file?

Assuming absolutely nothing about your data, this should dump the saved data into a single matfile (one variable per loaded file...

How to copy data from multiple .mat files into single .mat file?

Assuming absolutely nothing about your data, this should dump the saved data into a single matfile (one variable per loaded file...

2 maanden ago | 0

Answered

How to create multiple plots for time series data?

While you may want to think about a cleaner way of dealing with the plot (e.g., plotting in the same figure window and saving), ...

How to create multiple plots for time series data?

While you may want to think about a cleaner way of dealing with the plot (e.g., plotting in the same figure window and saving), ...

2 maanden ago | 0

| accepted

Answered

Finite difference scheme used in 'CURL' function?

You can actually see the full code using edit curl it looks like everything is based on gradient, which appears to use a 2-poi...

Finite difference scheme used in 'CURL' function?

You can actually see the full code using edit curl it looks like everything is based on gradient, which appears to use a 2-poi...

2 maanden ago | 0

| accepted

Answered

Need help writing code to attach date (1-365) from 30 years of data to the actual data needed to be processed. Trying to group into months.

edit: final code for this case: "What I am working with is a 842,382x3 matrix where the first column is a repetition of numbers...

Need help writing code to attach date (1-365) from 30 years of data to the actual data needed to be processed. Trying to group into months.

edit: final code for this case: "What I am working with is a 842,382x3 matrix where the first column is a repetition of numbers...

2 maanden ago | 0

| accepted

Answered

Using randsample on a matrix of weights

it doesn't seem like the assignment statement has any reason to be in the loop. Pulling it out may save a decent amount of time ...

Using randsample on a matrix of weights

it doesn't seem like the assignment statement has any reason to be in the loop. Pulling it out may save a decent amount of time ...

3 maanden ago | 0

| accepted

Answered

Multiply local values of a matrix with a vector

I'm not quite clear on which columns you want to change, but take a look at this and see if it makes sense: % sample matrix >>...

Multiply local values of a matrix with a vector

I'm not quite clear on which columns you want to change, but take a look at this and see if it makes sense: % sample matrix >>...

3 maanden ago | 0

| accepted

Answered

Convert several columns char matrix into one column char matrix

join? >> tmp={'a' 'b' 'c' ; 'd' 'e' 'f'} tmp = 2×3 cell 'a' 'b' 'c' 'd' 'e' ...

Convert several columns char matrix into one column char matrix

join? >> tmp={'a' 'b' 'c' ; 'd' 'e' 'f'} tmp = 2×3 cell 'a' 'b' 'c' 'd' 'e' ...

3 maanden ago | 0

Answered

How to make a structure to be input of a function and then its updated version to be output of the function?

function new_struct = update_struct(old_struct,add_field, add_val) new_struct = old_struct; new_struct.(add_field) = a...

How to make a structure to be input of a function and then its updated version to be output of the function?

function new_struct = update_struct(old_struct,add_field, add_val) new_struct = old_struct; new_struct.(add_field) = a...

3 maanden ago | 0

| accepted

Answered

are there GPU settings in matlab?

Most code will not be run on the GPU without adjustment There are guides here and it looks pretty easy for many applications:...

are there GPU settings in matlab?

Most code will not be run on the GPU without adjustment There are guides here and it looks pretty easy for many applications:...

3 maanden ago | 0

Answered

how can i solve this error?and how can i get wavelet toolbox ?

Check here whether you have a license for it, or need to buy: https://www.mathworks.com/products/wavelet.html?s_tid=srchtitle#tr...

how can i solve this error?and how can i get wavelet toolbox ?

Check here whether you have a license for it, or need to buy: https://www.mathworks.com/products/wavelet.html?s_tid=srchtitle#tr...

3 maanden ago | 0

Answered

how to choose a random excel cell in a certain coloum

If you have R2019a or above, use readmatrix. But, the issue is that you are mixing up passing a variable and a string. It happ...

how to choose a random excel cell in a certain coloum

If you have R2019a or above, use readmatrix. But, the issue is that you are mixing up passing a variable and a string. It happ...

3 maanden ago | 0

Answered

Save data to Excel without overlapping

Check out writematrix: https://www.mathworks.com/help/matlab/ref/writematrix.html#mw_f36f6f84-e6bd-4749-8957-a88b07036116 Somet...

Save data to Excel without overlapping

Check out writematrix: https://www.mathworks.com/help/matlab/ref/writematrix.html#mw_f36f6f84-e6bd-4749-8957-a88b07036116 Somet...

3 maanden ago | 0

| accepted

Answered

how to make label y axis specific?

% if you want a label at 0, make sure to include it in your limits ylim([0 1000]) yticks([0 500 1000])

how to make label y axis specific?

% if you want a label at 0, make sure to include it in your limits ylim([0 1000]) yticks([0 500 1000])

3 maanden ago | 0

Answered

Converting nested "summary" structure to table

Here's the loop version. There may be another way, but I didn't have any luck fighting with Matlab's tricky multiple-cell return...

Converting nested "summary" structure to table

Here's the loop version. There may be another way, but I didn't have any luck fighting with Matlab's tricky multiple-cell return...

3 maanden ago | 0

| accepted

Answered

How to find the non-zero minimum of a subset of matrix elements

The issue is that logical indexing doesn't work when you are checking against a subset of the matrix: >> A = [1 2 3 4; 2 0 1 5;...

How to find the non-zero minimum of a subset of matrix elements

The issue is that logical indexing doesn't work when you are checking against a subset of the matrix: >> A = [1 2 3 4; 2 0 1 5;...

3 maanden ago | 0

| accepted

Answered

Changing the number of xticks on heatmat (without changing the data)

Try: xt=xticks; xticks(xt(1:10:end)) If that doesn't work, it sounds like ax = gca; ax.XDisplayData = [date(1:10:end)]; % ...

Changing the number of xticks on heatmat (without changing the data)

Try: xt=xticks; xticks(xt(1:10:end)) If that doesn't work, it sounds like ax = gca; ax.XDisplayData = [date(1:10:end)]; % ...

3 maanden ago | 1