Community Profile

photo

Stephen


2014 以来アクティブ

Suspensa Vix Via Fit

Statistics

All
  • Grand Master
  • Personal Best Downloads Level 4
  • Editor's Pick
  • First Review
  • 5-Star Galaxy Level 5
  • GitHub Submissions Level 3
  • First Submission
  • 36 Month Streak
  • Thankful Level 4
  • Revival Level 2
  • Knowledgeable Level 4
  • First Answer

バッジを表示

Content Feed

表示方法

回答済み
I need a function to identify if a number is part of a vector or matrix.
Where M is your matrix and N is your scalar number: any(N==M(:))

約2時間 前 | 1

回答済み
change the first digits when ends with 5959
Rather than messing around with strings you should probably just work with duration objects or numeric arrays. S = ["000000";"0...

約5時間 前 | 0

| 採用済み

回答済み
How to merge two tables, keeping independent variable (x) the same but summing the dependent variable (y)
Simpler: T1 = readtable('Confoss_landings.xls', 'VariableNamingRule','preserve') T2 = readtable('Mainefoss_landings.xls', 'Var...

約8時間 前 | 0

回答済み
Interpolate/Resample to a specific decimal point
Assuming no adjacent duplicate values: S = 1; V = [1,3,4,7,6,3,6]; X = cumsum([1,abs(diff(V))]); Z = interp1(X,V,1:S:X(end))...

約8時間 前 | 0

| 採用済み

回答済み
How to combine 2 tables with different variables into 1 table?
The actual MATLAB solution just takes one simple line of code: SysTime = [1;2;3;4;5]; EDF = [10;20;30;40;50]; T1 = table(SysT...

約11時間 前 | 1

回答済み
How to properly format a data table with fprintf?
A = [1,2,3,4,5]; fprintf('Numbers%s\n',sprintf(' %1.2f',A))

約11時間 前 | 0

回答済み
Why the results of the matrix X' dont show?
Use https://www.mathworks.com/help/matlab/ref/mldivide.html A = [0,2,-1,0;0,0,1,-1;1,-1,0,0;-1,0,0,1]; B = [100;-500;300;100];...

約18時間 前 | 1

| 採用済み

回答済み
Create Multiple Arrays While Looping Through One Single Array
By far the simplest and most efficient solution is to use one matrix: V = 1:81 M = reshape(V,9,9).' You can trivially access ...

1日 前 | 1

| 採用済み

回答済み
how to add elements to an array in a for loop
The MATLAB approach is to use logical indexing, not a loop: V = [2,4,5,6,3]; N = sum(V(V>=5))

2日 前 | 0

回答済み
I am unable to display my answers on command window
https://www.mathworks.com/help/matlab/ref/display.html a = [3 6 1 9; 6 5 3 7; 7 3 2 6]; display(a)

2日 前 | 0

回答済み
Convert MAT file to v7.3
You can load and save the individual (or any selected) variables using the structure approach too. Lets try it: A = 1:3; B = 4...

4日 前 | 0

回答済み
linspace not working on MATLAB Coder
In MATLAB it is usually better to loop over indices. Perhaps this would work: V = linspace(-r_max*Tc_usbl,r_max*Tc_usbl,decisio...

4日 前 | 1

| 採用済み

回答済み
Normalize unit vector to single didgit integers
fun = @(V) round(V./10.^floor(log10(abs(V)))); fun([0.4,-0.4,0.8]) fun([0.123,0.123,0.5]) Note that this scales each element ...

5日 前 | 0

回答済み
How can I run this script and only create folders with files in it without having an additional file outside the folder?
Get rid of the FOPEN and FCLOSE, they are completely unrelated to WRITEMATRIX: start = tic; % input n and m n = input('\n How...

8日 前 | 1

| 採用済み

回答済み
Why does .m4a audio file (imported via audioread) get stored in workspace with two data series/data columns instead of just one?
Clearly your audio file has two channels. The MATLAB documentation states that the first output is "... returned as an m-by-n ma...

10日 前 | 1

回答済み
random selection from 5 different vectors
C = {[1;2;3;2],[4;5],[7;8;9],[0;1;2],linspace(0,1,101)}; V = {1,1,1,1,2}; F = @(v,n)v(randi(numel(v),1,n)); Z = cell2mat(cell...

10日 前 | 0

| 採用済み

回答済み
Plotting numeric data vs time (from text file)
"I am trying to import some numeric data from a text file and then plot it in MATLAB." T = readmatrix('time.txt'); M = readmat...

10日 前 | 1

| 採用済み

回答済み
Use a structure with fields in a loop - Outputs & indexing ??
Where S is your structure: F = @(a)a.Sig(1); V = arrayfun(F,S)

11日 前 | 0

| 採用済み

回答済み
How to load multiple .mat files containing timetables into the workspace and concatenate them vertically
"Do I have to rename the structs..." No, you do not need to. But in future when designing data you should keep the structure n...

18日 前 | 0

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

19日 前 | 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...

20日 前 | 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...

21日 前 | 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...

21日 前 | 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 = ...

23日 前 | 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 ...

25日 前 | 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

26日 前 | 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...

28日 前 | 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 ...

28日 前 | 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)

28日 前 | 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>=...

28日 前 | 0

| 採用済み

もっと読み込む