Community Profile # Stephen23

2014 이후 활성

Suspensa Vix Via Fit

#### Statistics

All
• • • • • • • • • • • • 배지보기

#### Content Feed

보기 기준

답변 있음
Making Matrix dimensions agree
x=-2:0.04:2; y=-4:0.04:4; [X,Y] = meshgrid(x,y); fXY = X.*exp((-X.^2)-(Y./2).^2); % use X and Y here, not x and y. surf(X,Y,...

약 5시간 전 | 2

| 수락됨

답변 있음
Merge rows of cell array with strings per column?
C = {'A','C'; 'B','D'} D = cellfun(@(c)join(c,''),num2cell(C,1)) D = cellfun(@(c)[c{:}],num2cell(C,1),'uni',0)

1일 전 | 0

| 수락됨

답변 있음
How do I split a vector into parts using indexes?
x = 1:100; y = [10,40,60]; C = mat2cell(x(1:y(end)),1,diff([0,y]))

1일 전 | 0

답변 있음
Could not recognize the format of the date/time text
C = ["07/04/2021 07:55:27.502.118" "07/04/2021 07:55:27.502.196" "07/04/2021 07:55:27.502.274" "07/04/2021 07:55:...

2일 전 | 0

| 수락됨

답변 있음
extract number of columns in each row
Where C is your cell array: V = cellfun(@numel,C) V = cellfun('size',C,2)

2일 전 | 1

| 수락됨

답변 있음
Function that outputs a varying number of variables depending on input --> N inputs = N output variables
"To my understanding I would be unable to use alternate methods given that the data I am loading are mutlidimensional arrays of ...

2일 전 | 0

| 수락됨

답변 있음
To write a For loop in which a variable is updated with each run.
"I want to make this more efficient by using a for loop (if it can be done)." Of course it can be done, you just need to avoid ...

4일 전 | 0

| 수락됨

답변 있음
Using an array as an element in a function.
Use element-wise division ./ not matrix division / You will probably also need to use element-wise power .^, not matrix power ^...

5일 전 | 0

답변 있음
create cell array by extracting all the same row from multiple matrix
"Is this achievable through cellfun?" Yes: A = rand(105,3); B = rand(105,3); C = rand(105,3); D = cellfun(@vertcat,num2cell...

8일 전 | 0

| 수락됨

답변 있음
I want to enter a mathematical function as an argument to a function
The simple approach using a function handle: plot_compare(@sin , 5 ,20); plot_compare(@(t) 4*t+9 , 5 ,20); function plot_co...

8일 전 | 0

| 수락됨

답변 있음
How to create a table from strings and numerical data?
" I don't want to preallocate anything as the sizes are unknown. I wanna start with an empty table and then after first iteratio...

9일 전 | 0

답변 있음
Plot the last value from each cell from excel file
"Could you please provide me the best way to extract the last values in each cell and plot it?" Sure, I already did that sixtee...

9일 전 | 0

| 수락됨

답변 있음
Alternative to Eval for small number of variables
Approaches like EVAL and structure fields for this task are far too complex. You need to learn how to use arrays to write simpl...

10일 전 | 0

답변 있음
Convert input item into string
https://www.mathworks.com/help/matlab/ref/inputname.html

11일 전 | 1

| 수락됨

답변 있음
Extract value until regexp case match
Does the data you want to match always occur at the start of the string? A = "9/12/2022 7:38:51 PM 216 Indicator"; B = regexp(...

12일 전 | 1

| 수락됨

답변 있음
Sine Function I'm trying to Plot won't show up
"Not sure what I'm doing wrong here." You need to use element-wise division, not matrix division: phi = 0:0.1:6*pi; I2 = sin(...

13일 전 | 1

| 수락됨

답변 있음
replacing text in a string using indexing
For overlapping matches use STRREP. For non-overlapping matches use REGEXPREP: regexprep('qqqqqq','qqq','qwe') regexprep('qqq...

14일 전 | 0

답변 있음
How can I discretize data by their sign?
A = [-2,-1,5,-10,7,3,-9,-12,11]; B = sign(A); C = cumsum(logical([1,diff(B)]))

16일 전 | 0

| 수락됨

답변 있음
Skipping certain lines using fscanf
C = {}; [fid,msg] = fopen('polydata.txt','rt'); assert(fid>=3,'%s',msg) while ~feof(fid) C{end+1} = sscanf(fgetl(fid),'%...

16일 전 | 0

답변 있음
Creating Own Time Variable from Datetime Data
"I hope someone can help me convert my datetime time variable into working with a new time variable, thanks. " Your question do...

16일 전 | 0

| 수락됨

답변 있음
How inv() works ?
The INV documentation states "inv performs an LU decomposition of the input matrix (or an LDL decomposition if the input matrix ...

17일 전 | 1

답변 있음
Convert matrix into CSV, with each matrix element as a separate line including indices of matrix element
M = [0.5,0.1,0.6;0.9,0.8,0.3] N = M.'; S = size(N); [X,Y] = ndgrid(1:S(1),1:S(2)); writematrix([X(:),Y(:),N(:)],'test.txt') ...

18일 전 | 1

답변 있음
Why does the code have Check for incorrect argument data type or missing argument in call to function 'zero'?
Change the function from ZERO to ZEROS. ZEROS creates an array of the value 0: https://www.mathworks.com/help/matlab/ref/zeros....

19일 전 | 1

답변 있음
how filter "*.*" when using uigetfile function.
If there are no descriptors, the "All files" is automatically appened onto the end of the filter. The solution is to add descrip...

19일 전 | 0

| 수락됨

답변 있음
How to subtract ?
The simple MATLAB approach: S = load("allmat.mat"); M = S.allmat M(:,6) = M(1,6)-cumsum(M(:,5))

20일 전 | 0

| 수락됨

답변 있음
Creating a table by extracting rows from a table based off their values in relation to another table of a different size.
a = [11;33;55;77;99;23;45;67;89;87;65;43;10;1;3;5]; b = [22;44;66;88;12;34;56;78;98;76;54;32;21;2;4;6]; c = [2;2;2;2;4;4;4;4;6...

21일 전 | 0

답변 있음
I got wrong data when i use datetime convertfrom
S = load('time.mat'); D = S.time T = datetime(1800,1,1) + hours(D)

21일 전 | 0

| 수락됨

답변 있음
How to use the command window in order to make a script faster and interactive?
I had to write a script to carefully remove all of those numbers from the variable names and recreate the original MAT files acc...

21일 전 | 0

| 수락됨

답변 있음
Using diff(x) function to create a new table by subtracting values from the previous row
M = readmatrix('Data241.xlsx') [~,idr] = sort(isnan(M),1); [~,idc] = ndgrid(1:size(M,1),1:size(M,2)); A = -diff(M(sub2ind(siz...

21일 전 | 1

| 수락됨

답변 있음
Error in datetime array format for writing new matrix
Ah, fractional years. Here is one way to convert a fractional year (yes, even leap years) to datetime: format long G M = readm...

21일 전 | 0

| 수락됨