Answered

How do I save values in my loop as a column vector?

You can use h1(:) instead to make hi1 explicitely a column vector. This has a potential risk too if you h1 is actually a matrix ...

How do I save values in my loop as a column vector?

You can use h1(:) instead to make hi1 explicitely a column vector. This has a potential risk too if you h1 is actually a matrix ...

plus de 2 ans ago | 0

Answered

hello, I am receiving an error . It says Undefined function or variable 'grayImage'. please let me know how i can define the function . here is my code

you have to have image data first which the grayImage is supposed to be. you can use imread to read an image in your disk for ex...

hello, I am receiving an error . It says Undefined function or variable 'grayImage'. please let me know how i can define the function . here is my code

you have to have image data first which the grayImage is supposed to be. you can use imread to read an image in your disk for ex...

plus de 2 ans ago | 0

Answered

Assigning colours to a group of columns when using plot

Dot indexing doesn't support this. You can use set(p(1:10), 'Color', 'red'); instead. A further note is that when you use dot i...

Assigning colours to a group of columns when using plot

Dot indexing doesn't support this. You can use set(p(1:10), 'Color', 'red'); instead. A further note is that when you use dot i...

plus de 2 ans ago | 1

| accepted

Answered

How can I label images with numbers for the purposes of machine learning?

One solution is to save images with the same number of mms in one folder and name that folder with the number of mms. You can lo...

How can I label images with numbers for the purposes of machine learning?

One solution is to save images with the same number of mms in one folder and name that folder with the number of mms. You can lo...

plus de 2 ans ago | 0

Answered

Fullfile function gives me a false reading with the slash symbol

fileToRead = fullfile('C:\Users\thomas\Files\', [CCC '.csv']);

Fullfile function gives me a false reading with the slash symbol

fileToRead = fullfile('C:\Users\thomas\Files\', [CCC '.csv']);

plus de 2 ans ago | 1

| accepted

Answered

i need a example code for Single-level discrete 2-D wavelet transform

Say x is your signal and you’d like to do an n-level decomposition, using [C, L] = wavedec(x, n, ‘db2’); db2 is the wavele...

i need a example code for Single-level discrete 2-D wavelet transform

Say x is your signal and you’d like to do an n-level decomposition, using [C, L] = wavedec(x, n, ‘db2’); db2 is the wavele...

plus de 2 ans ago | 0

Answered

How can I properly index a table using isnan? (R2020a)

Either use dot notion or {} pair to access a table element. Try R.Var1(1) for example.

How can I properly index a table using isnan? (R2020a)

Either use dot notion or {} pair to access a table element. Try R.Var1(1) for example.

plus de 2 ans ago | 0

| accepted

Answered

How to show word from excel?

subT = T(T.NO == 1, [2 5 6]); Will be the first record with the 2nd 5th and 6th variable as a new table.

How to show word from excel?

subT = T(T.NO == 1, [2 5 6]); Will be the first record with the 2nd 5th and 6th variable as a new table.

plus de 2 ans ago | 0

| accepted

Answered

Trying to put values from one array into another

A(:) ./ size(A, 1) * ones(1, size(A, 1)); If I understand what you said correctly, the above script will give you what you ne...

Trying to put values from one array into another

A(:) ./ size(A, 1) * ones(1, size(A, 1)); If I understand what you said correctly, the above script will give you what you ne...

plus de 2 ans ago | 0

Answered

Copyfile/ movefile when filenames are not directly available

flagged is a cell so you couldn’t access it using parentheses and dot motion. flagged{i} is your ith element in flagged. For ...

Copyfile/ movefile when filenames are not directly available

flagged is a cell so you couldn’t access it using parentheses and dot motion. flagged{i} is your ith element in flagged. For ...

plus de 2 ans ago | 1

| accepted

Answered

How to add the value of the 3 highest elements automatically from a vector?

[~, ind] = sort(y); y(ind(end-2, end)) = y(ind(ind-2, end)) + ax; Should meet your need.

How to add the value of the 3 highest elements automatically from a vector?

[~, ind] = sort(y); y(ind(end-2, end)) = y(ind(ind-2, end)) + ax; Should meet your need.

plus de 2 ans ago | 1

Answered

Substract Each Element in A Matrix MAT1 from all the elements of another Matrix MAT2

What MATLAB version are you using? Newer versions actually support operations between e.g. a vector and a 2-d matrix if they ha...

Substract Each Element in A Matrix MAT1 from all the elements of another Matrix MAT2

What MATLAB version are you using? Newer versions actually support operations between e.g. a vector and a 2-d matrix if they ha...

plus de 2 ans ago | 0

Answered

Extracting values that are greater than the threshold

outAlert = Alert(Alert(:, 3) > 21, :); should be what you want to have

Extracting values that are greater than the threshold

outAlert = Alert(Alert(:, 3) > 21, :); should be what you want to have

plus de 2 ans ago | 0

| accepted

Answered

Monthly data to seasonal using sum (how to use splitapply)

Try below tbl = CELL{1}; tbl.month = month(tbl.dates); tbl.season = floor(tbl.month ./ 3); tbl.season(tbl.season == 4) = 0...

Monthly data to seasonal using sum (how to use splitapply)

Try below tbl = CELL{1}; tbl.month = month(tbl.dates); tbl.season = floor(tbl.month ./ 3); tbl.season(tbl.season == 4) = 0...

plus de 2 ans ago | 1

| accepted

Answered

FFT of a time-valued signal, then IFFT doesn't return the same signal

fs=200000; time=0:1/fs:2-1/fs; data=load(['S09H4R2.dat']); Ffrapp=2*fft(data(:,1))./length(data(:,1)); Fsarf=2*fft(data(:,2)...

FFT of a time-valued signal, then IFFT doesn't return the same signal

fs=200000; time=0:1/fs:2-1/fs; data=load(['S09H4R2.dat']); Ffrapp=2*fft(data(:,1))./length(data(:,1)); Fsarf=2*fft(data(:,2)...

plus de 2 ans ago | 0

| accepted

Answered

How can i create an array with datetime values as one column and integers as one column?

you can use table instead of an array. table can have columns with different types. e.g., a = yourDatetime; b = yourInteger...

How can i create an array with datetime values as one column and integers as one column?

you can use table instead of an array. table can have columns with different types. e.g., a = yourDatetime; b = yourInteger...

plus de 2 ans ago | 0

| accepted

Answered

Plot implicit function with the summation inside

z1 = @(w_c, mu) 1 + w_c / pi ... * sum((-1).^n / n .* 2 * pi^2 * n .* t ... % are you sure that the first / and the second ...

Plot implicit function with the summation inside

z1 = @(w_c, mu) 1 + w_c / pi ... * sum((-1).^n / n .* 2 * pi^2 * n .* t ... % are you sure that the first / and the second ...

plus de 2 ans ago | 0

Answered

How do I perform a channel with probability?

% simulate a sequence r r = [ones(100, 1); zeros(100, 1)]; ind = randperm(length(r)); r = r(ind); % randsrc generate a...

How do I perform a channel with probability?

% simulate a sequence r r = [ones(100, 1); zeros(100, 1)]; ind = randperm(length(r)); r = r(ind); % randsrc generate a...

plus de 2 ans ago | 0

| accepted

Answered

how to center a string

function out = padline(c, n) if n > length(c) n2add = floor((n - c) / 2); out = [repmat(‘ ‘, 1, n2add) c repmat(‘ ‘, 1, n - leng...

how to center a string

function out = padline(c, n) if n > length(c) n2add = floor((n - c) / 2); out = [repmat(‘ ‘, 1, n2add) c repmat(‘ ‘, 1, n - leng...

plus de 2 ans ago | 0

| accepted

Answered

How do I set legend labels depending on number of plotted data?

So using your style legendStr = []; for iL = 1:numberOfObj legendStr = [legendStr; string(inputdlg([‘what is the legend # ’...

How do I set legend labels depending on number of plotted data?

So using your style legendStr = []; for iL = 1:numberOfObj legendStr = [legendStr; string(inputdlg([‘what is the legend # ’...

plus de 2 ans ago | 0

| accepted

Answered

Error: Line 91 Column: 44 When calling a function or indexing a variable , use parentheses. Otherwise, check for mismatched delimiters

Matlab uses comma not ; Parameter names are without spaces. And you have an extra ) that doesn’t have a ( to match it.

Error: Line 91 Column: 44 When calling a function or indexing a variable , use parentheses. Otherwise, check for mismatched delimiters

Matlab uses comma not ; Parameter names are without spaces. And you have an extra ) that doesn’t have a ( to match it.

plus de 2 ans ago | 0

Answered

How to add values into a vector with for loop in a function

It looks that in your function test1, the second parameter SOC_a is supposed to be a vector. While in your main function, when ...

How to add values into a vector with for loop in a function

It looks that in your function test1, the second parameter SOC_a is supposed to be a vector. While in your main function, when ...

plus de 2 ans ago | 1

Answered

Error using legend MATLAB R2019b

what is your signalLabels? Is that a cell or a string matrix?

Error using legend MATLAB R2019b

what is your signalLabels? Is that a cell or a string matrix?

plus de 2 ans ago | 0

| accepted

Answered

Legend in plot using forloop

Not quite sure what you meant by "the legend stays wrong", but please try this if my guess is correct. figure(1) ee = linspace...

Legend in plot using forloop

Not quite sure what you meant by "the legend stays wrong", but please try this if my guess is correct. figure(1) ee = linspace...

plus de 2 ans ago | 0

| accepted

Answered

Creating a matlab function that reads the raw input data, given in the text file.

Is the text file contains data with fixed columns and rows? If yes, you can try using readtable. If there is a headline in the t...

Creating a matlab function that reads the raw input data, given in the text file.

Is the text file contains data with fixed columns and rows? If yes, you can try using readtable. If there is a headline in the t...

plus de 2 ans ago | 0

Answered

How to store a string of n elements as one element of a matrix

You may want to try a cell array instead? N{i, j} = Nff;

How to store a string of n elements as one element of a matrix

You may want to try a cell array instead? N{i, j} = Nff;

plus de 2 ans ago | 0

Answered

strtok is only using the first character of my delimiter instead of the full character vector

why don't you use strsplit instead? >> a = strsplit('Hello World', 'HAIR') a = 1×1 cell array {'Hello World'} ...

strtok is only using the first character of my delimiter instead of the full character vector

why don't you use strsplit instead? >> a = strsplit('Hello World', 'HAIR') a = 1×1 cell array {'Hello World'} ...

plus de 2 ans ago | 0

Answered

Plotting a graph with multiple constraints

x >= 2 & x <= 5 this express will consider both constraints in. Is this what you need?

Plotting a graph with multiple constraints

x >= 2 & x <= 5 this express will consider both constraints in. Is this what you need?

plus de 2 ans ago | 0

Answered

Function that squares each elemnt of a matrix

If you only want to square each element of a matrix, you use .^ For example: A = randn(100, 100); B = A.^2;

Function that squares each elemnt of a matrix

If you only want to square each element of a matrix, you use .^ For example: A = randn(100, 100); B = A.^2;

plus de 2 ans ago | 0

Answered

How to read CSV file and save the result to another CSV file

a simple structure: outDir = yourDestination. allCsvFiles = dir(fullfile(yourDirectory, '.*csv')); for iA = 1:length(allCsv...

How to read CSV file and save the result to another CSV file

a simple structure: outDir = yourDestination. allCsvFiles = dir(fullfile(yourDirectory, '.*csv')); for iA = 1:length(allCsv...

plus de 2 ans ago | 0

| accepted