回答済み
Please help i seem to be failing to understand what the following errors mean and how to correct for them.
I suspect that something like this is what you are trying to do (I fixed many small bugs): g = 9.8; %gravit...

約2ヶ月 前 | 0

| 採用済み

回答済み
How to make the variable pace, a data type double
T = [0,33,3]; % the atheletes goal time [H,M,S] D = 10; % km P = required_pace1(T,D) class(P) P = required_pace2(T,D) % Usi...

約2ヶ月 前 | 0

| 採用済み

回答済み
Error using length, Too many input arguments.
if length(Obj.MatFile{cellnumber}{j}.(ExtractField))==2 But note that you do not need to check the length: taking the mean of o...

約2ヶ月 前 | 1

回答済み
Save output of a for loop in a vector
str = 'hello world. eat lots of bananas.'; target = zeros(150,1); for k = 4:numel(str) target(k) = isequal(str(k), str(k...

約2ヶ月 前 | 0

回答済み
Creating a new matrix and insert certain values into that matrix
I suspect that you are asking about SUB2IND: R = [1,3,3,2,2,3,3,4,3]; C = [1,1,1,3,4,1,2,1,4]; V = [2,2,2,4,2,3,3,2,1]; M = ...

約2ヶ月 前 | 0

| 採用済み

回答済み
Strings to variable names
Mixing up unrelated topics has made you think that this is much more complex than it really is. Look at your own code that you ...

約2ヶ月 前 | 1

回答済み
Random Number from a given vector of numbers
V = [-1,23,99,111,1024]; N = 3; A = V(randi(numel(V),1,N)) % with repetition B = V(randperm(numel(V),N)) % no repetition

約2ヶ月 前 | 1

| 採用済み

回答済み
How do I reformat a set of differently formatted dates in to one consistent format?
There is no tool which will correctly interpret the mutually-exclusive date formats used around the world: https://en.wikipedia...

約2ヶ月 前 | 0

| 採用済み

回答済み
Rewriting code without loops
Fake data: dev = rand(101,1); GradW = rand(4,101); HessW = rand(4,4,101); Your code: A = zeros(4,4,101); for i=1:101 ...

約2ヶ月 前 | 0

| 採用済み

回答済み
How to zero mean a 3-D array
The simple MATLAB approach: S = load('matlab.mat') A = S.A A = A - mean(A,2:3)

約2ヶ月 前 | 0

| 採用済み

回答済み
Won't show me my variable?
"What can I change to fix it?" Use logical indexing, e.g.: I = 0.5 * Ms; X = Ms>=3.5; I(X) = 21.29 * Ms(X) - 69.4; X = Ms>=...

約2ヶ月 前 | 0

| 採用済み

回答済み
Extract specific field names and associated data from a structure
Rather than using an IF it would be simpler to specify an appropriate filename for DIR: P = 'myfile'; S = dir(fullfile(P,'*bf_...

2ヶ月 前 | 0

| 採用済み

回答済み
How can I extract the same variable from multiple files & concatenate them efficiently?
"I just can't seem to figure out how to efficiently extract a u and v vector from each file within the loop using my function be...

2ヶ月 前 | 0

回答済み
Replace empty string with NaN in a cell
A = {"20","25","25",[],"20",[],"25","25","25","30"} A(cellfun(@isempty,A)) = {"NaN"} Using one string array is likely much bet...

2ヶ月 前 | 0

| 採用済み

回答済み
copying specific elements of an array to another.
Forget about loops, the simple and efficient MATLAB approach is to use logical indexing: g = y(y>0.001)

2ヶ月 前 | 1

| 採用済み

回答済み
how to shift rows to right and left of matrix ?
M = [1,2,3;4,5,6;7,8,9] A = [3,2,1]; B = [2,5,2]; c = [4,1,3]; for k = 1:size(M,1) if A(k)<B(k) %shift row to right wit...

2ヶ月 前 | 0

| 採用済み

回答済み
How to create a pivot table from this table, Part 2
customer = {'Customer 1';'Customer 2';'Customer 3';'Customer 4'}; location = {'NY';'LA';'Austin';'LA'}; gender = {'male';'fe...

2ヶ月 前 | 0

| 採用済み

回答済み
Doubt regarding max(A,B).
"Why is max(A,B) as [10 6 5]?" Because that syntax provides an element-wise comparison of the two input arrays, taking the maxi...

2ヶ月 前 | 3

回答済み
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

2ヶ月 前 | 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...

2ヶ月 前 | 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...

2ヶ月 前 | 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...

2ヶ月 前 | 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...

2ヶ月 前 | 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...

2ヶ月 前 | 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...

2ヶ月 前 | 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:...

2ヶ月 前 | 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...

2ヶ月 前 | 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...

2ヶ月 前 | 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...

2ヶ月 前 | 1

| 採用済み

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

2ヶ月 前 | 2

もっと読み込む