回答済み
changing the existing variables on the for loop
abc = [1,3,5,7]; k = abc; r = abc; for ii = 1:5 [r,k] = deal(k+3,r+5) end

約1ヶ月 前 | 0

| 採用済み

回答済み
how to use for loop for iterations in matrices?
"how to use for loop for iterations in matrices?" Do NOT number the variable names, unless you want to force yourself into writ...

約1ヶ月 前 | 0

| 採用済み

回答済み
Assigning an arbitrary number to an array
x = [2.32, 4.23, 1.92, 3.24, 2.13]; points = [3, 1, 2]; first_answer = x(points); [second_answer,idx] = min(first_answer); t...

約1ヶ月 前 | 0

| 採用済み

回答済み
Sort column vectors of a matrix and extract a new vector from a maximal criterion
M = [1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2; 1,1,1,1,2,2,2,2,4,4,4,1,1,1,2,2,2; 1,2,3,4,1,2,3,4,1,2,3,2,3,4,1,2,3; 31,16,15,9,10,8,13...

約1ヶ月 前 | 0

| 採用済み

回答済み
Assignment in a for loop
"Any suggestion how to solve this simple looking problem?" Use a non-scalar structure: https://www.mathworks.com/help/matlab/m...

約1ヶ月 前 | 0

回答済み
How to save local variables (which are within a called function)
"...there are some variables (calculated inside the function @ODE_System) and i would like to see and save their values along wi...

約1ヶ月 前 | 0

回答済み
How to do matrix Preallocation?
"what am i doing wrong?" You are concatenating the new data onto the bottom of your preallocated matrix, rather than using inde...

約1ヶ月 前 | 0

回答済み
what does a = T(m:m, 'label'); mean?
"what does a = T(m:m, 'label'); mean?" It refers to row m of variable/column "label" of the table T, returning a table: https:...

約1ヶ月 前 | 1

| 採用済み

回答済み
A query relating a function with 3 input arguments.
"Why is the answer '-21' and not '-9'?" Because this code x>y>z is parsed from left to right as (x>y)>z which (because true...

約1ヶ月 前 | 1

| 採用済み

回答済み
Functional programming construct to expand cell array into arguments for other functions without using an intermediate variable in the (user) code?
The closest is to use the new syntax which allows dot indexing directly into function outputs: https://www.mathworks.com/help/m...

約1ヶ月 前 | 0

| 採用済み

回答済み
Constructing names of array and structure variables
"I'm trying to dynamically create variable names, for array and struc variables" But your example shows you changing a structur...

約1ヶ月 前 | 1

| 採用済み

回答済み
Regular expression: how to search for a sequence of one number alternated with 0s?
S = '5ad3515505546151g545460000051333300342511324sgfb15654404440044532152331450005534563asdf4453415364043344004044453'; C = reg...

約1ヶ月 前 | 2

回答済み
Split comma seperated values inside a cell in to multiple columns
Simpler and more efficient: % load your data: S = load('split_mat.mat'); C = S.split_mat; % convert to numeric: F = @(t)ssc...

約1ヶ月 前 | 0

回答済み
How to remove all the rows containing a substring from a table?
Simple and efficient MATLAB approach: A = [0;1;2;3;4]; B = ["cat";"hat";"sat_Downstream";"fat";"rat_Downstream"]; C = [5;6;7;...

約1ヶ月 前 | 0

回答済み
Problem using textscan multiple times for one file
"How can I solve this problem?" After calling TEXTSCAN the first time the file pointer will be at (or near) the end of the file...

約1ヶ月 前 | 0

回答済み
Replace NaN with median per column
M = randi(3,5,7); M(randi(numel(M),1,9)) = NaN V = median(M,1,'omitnan') X = isnan(M); M(X) = repelem(V,sum(X,1))

約1ヶ月 前 | 1

回答済み
How i can combine three or more than three matrix?
Note that you will run out of memory very quickly as you increase the number of matrices. format compact inp = {rand(3,4),rand...

約1ヶ月 前 | 0

| 採用済み

回答済み
'Merge' two cell arrays into one single cell array (NOT concatenation!)
c1 = {[1;2],5} c2 = {[3;4],[6;7;8;9;10]} out = cellfun(@vertcat,c1,c2,'uni',0) celldisp(out)

約1ヶ月 前 | 0

| 採用済み

回答済み
How I can create this matrix?
X = A(:,5)<1; A(X,:) = []

約2ヶ月 前 | 1

| 採用済み

回答済み
return matrix rows and columns using a one-to-one mapped vector for rows and vector for column
Use sub2ind: idx = sub2ind(size(A),pnRowsToSelect,pnColsToSelect); out = A(idx)

約2ヶ月 前 | 0

| 採用済み

回答済み
Convert Time Given in Seconds to Minute, Seconds, Milliseconds
If you really need minutes (i.e. and not roll-over to hours for >59 minutes) then you can calculate this yourself, e.g.: inp = ...

約2ヶ月 前 | 0

回答済み
replace specific commas using strrep
"I converted my data... using str2num." Although your descriptiion is unclear, I guess that your goal to convert text data into...

約2ヶ月 前 | 0

回答済み
How can I create this matrix?
n = 5; r = 2:5; F = @(k)any(permute(nchoosek(1:n,k),[3,1,2])==(1:n).',3); M = cell2mat(arrayfun(F,r,'uni',0))

約2ヶ月 前 | 1

| 採用済み

回答済み
Effective matrix defining (diagonals)
N = 7; M = toeplitz([-2,1,zeros(1,N-2)])

約2ヶ月 前 | 1

| 採用済み

回答済み
Remove String and extract numbers to move to new column
S = [... "[0, 0]" "[0, 5]" "[5, 115]" "[115, 219]" "[219, 262]" "[262, 328]" "[328, 408]" "[408, 424]" "[424, 531]" "[...

約2ヶ月 前 | 0

| 採用済み

回答済み
Help with regexp to extract data
tdata = {'W1W','W1W 7','W1W 8','AZ_85262','CA_90032','CA_90045'}; tkn = regexp(tdata,'^(.*?)_?([^_]*)$','tokens','once'); tkn ...

約2ヶ月 前 | 0

| 採用済み

回答済み
complicated formatted text with textscan
I removed the extra line of numbers from block 3, the modified data file is attached. This code imports the modified data file:...

約2ヶ月 前 | 0

| 採用済み

回答済み
How to cut multiple file ans past it to folder?
mkdir 4ASK movefile frame4ASK*.m 4ASK

約2ヶ月 前 | 0

回答済み
Using cell array for indexing
No need for a loop, here is the simple and efficient MATLAB approach: IndArray = {i1,..,im}; IndArray(1+end:ndims(A)) = {':'};...

約2ヶ月 前 | 1

回答済み
How to organize an array (x_i,y_j,z) such that (x_i,y_i)=z?
The trick is to use https://www.mathworks.com/help/matlab/ref/sub2ind.html A = [1,1,2;1,2,0.5;2,1,0.5;2,2,1] S = max(A(:,1:2),...

約2ヶ月 前 | 0

| 採用済み

もっと読み込む