types of functions in matlab
A google search quickly came up with this documentation page and this documentation page that will probably answer your question...

21日 前 | 2

| 採用済み

Number of variables vary in function definition
Here is a different approach, using a loop and sprintf: % Count columns and preallocate X numberCols = size(A,2); X1 = cell(1...

23日 前 | 1

| 採用済み

Matrix with ones and zeros
Do you mean that you want every possible combination of 3x3 matrix filled with 0 or 1? The following is pretty obfuscated code, ...

23日 前 | 0

| 採用済み

Attempt to grow array along ambiguous dimension.
The way your defined your mult variables, they are 81-dimensional arrays. I think you meant: multA = ones(size(a)); multB = on...

23日 前 | 0

Loops slowing down dramatically with increased iterations
I have not gone through your code, but this is a classic symptom of failing to preallocate matrices, and instead letting them gr...

23日 前 | 0

Matrix transformation (sorting)
i = find(sort(A,'descend')); j = find(A); s = numel(A); T = zeros(s,s); T(sub2ind([s s],i,j)) = 1; I hope it's clear what...

23日 前 | 0

| 採用済み

How do I name the columns of my table by the names of row 1?
Did you try reading the documentation page for readtable? It seems that all you need to do is this: pos=readtable("Pos_data.cs...

24日 前 | 1

Remove zeros from a 3D array
Do you mean you have "slices" of all zeros? Then this should work: % Create an array like your A matrix, where some "slices" of...

25日 前 | 0

| 採用済み

Matrix transformation (sorting)
T = sort(A,'descend')/A Note that I am only using sort here to define the result you need. The transformation matrix you get as...

25日 前 | 1

Scatterplot, i need to plot one point instead of 4 present in my table
If I understand correctly, you want to do the following: A_mean = mean(reshape(A,4,[]))'; B_mean = mean(reshape(B,4,[]))'; C_...

29日 前 | 0

Fastest way to match elements in two vectors and return indices?
I have to admit that I have not dug into your code, but it sounds like the ismember function might be useful.

29日 前 | 0

summing elements of an array until a value appears
Here is one way. % Inputs inputVector = [5 4 3 2 1]; inputValueToFind = 2; % Find the location of the index idxEnd = find...

30日 前 | 0

How to translate Wolfram program to Matlab
Almost always, the best and "safest" thing to do is to understand what the underlying code is doing in the old language, and the...

30日 前 | 0

create diagonal matrix zeros
a = diag(1:10); a(1,:) = 1:10; a(:,1) = 1:10;

| 採用済み

How would I find the value of a corresponding data set?
When you say "corresponding", do you mean the 5th y(value) or the 3rd? y(index)

How to randomly select values in one matrix and make them equal to values of a second matrix?
while ... % <---- condition goes here idx = randi(400); x(idx) = y(idx); end

how can I find the probabilities of the ecdf function of each duplicate values in y ?
Do you mean you are trying to get these values? histcounts(num_off_time,'Normalization','probability') ans = 0.2000 ...

| 採用済み

Random order with constraints
If you have the Statistics and Machine Learning Toolbox, you could do it like this: x = sort(randsample(220,20,false)); while ...

Problem with obtain regression equation between 2 data sets
All these methods will give the same coefficient for the y/x sloped if you scale the variables first: rng default N = 10; ...

Graph the curve line
Use the plot3 command.

Cannot use datetime function on {'01 Nov 2019 14:39:50.365'}
s = '01 Nov 2019 14:39:50.365'; datetime(s,'InputFormat',"dd MMM yyyy HH:mm:ss.S")

| 採用済み

How to determine the x-axis positions of the bars in a grouped bar chart
Suppose I make the following bar chart: figure; bar([1 2],[3 4; 5 6]) How can I programatically find the x-axis locations of e...

### 3

fitting a dual exponential function using nlinfit
I made up some pretend data that looks a little bit like yours, and did your fit. Here is my code: % Make up some pretend data ...

| 採用済み

how to change the box width in boxplot?
You chose the "compact" plot style. Do you prefer this version, which is the default (non-compact)? Also, are you sure you ar...

Array indices must be positive integers or logical values
In this line: hfuncval(k) = hfuncval(k-1); in the first iteration of the for loop, k == 1, so you are attempting to access the...

How to specify histogram's x and y axis
You can use the xlim and ylim commands.

| 採用済み

Plotting estimates (fixed effects) of a linear mixed-model
I could find no mention in the documentation of the LinearMixedModel class that there is an equivalent object function or method...

how to convert to matlab from fortran
You could try f2matlab. It might not get you all the way to the final code you need, but it will probably help.

2ヶ月 前 | 0

using function to remove elements from a large matrix
idxToKeep = ismember(M(:,2),[1,2,3,11,12]); M = M(idxToKeep,:);

2ヶ月 前 | 0

| 採用済み

Creating all possible combination of 0 and 1 in 2D array
Did you mean you just want each possible unique row, rather than each possible unique matrix? justRows = dec2bin(0:2^m-1)-'0' ...

2ヶ月 前 | 0