Answered

Auto Detect different file types?

Since the only difference between the way the two file types are read with readtext() is the delimiter, you can try different de...

Auto Detect different file types?

Since the only difference between the way the two file types are read with readtext() is the delimiter, you can try different de...

4 dagar ago | 1

| accepted

Answered

Reading all values as a string from excel file

Maybe you can just convert the decimal times to datetimes using the datetime() function, after reading them in. now() datetime...

Reading all values as a string from excel file

Maybe you can just convert the decimal times to datetimes using the datetime() function, after reading them in. now() datetime...

5 dagar ago | 0

Answered

Crop image from imagesc, after creating the image.

You can set the axes YLim to the relevant part. In your case: set(gca(),'YLim',[-1 0]);

Crop image from imagesc, after creating the image.

You can set the axes YLim to the relevant part. In your case: set(gca(),'YLim',[-1 0]);

5 dagar ago | 1

Answered

How can I add string character description in the X axes instead of numbers? Is there a way to enhancer this code?

Something like this? clear all; %get rid of everything in memory close all; %close all open figures %X axis Test_Cases = { '...

How can I add string character description in the X axes instead of numbers? Is there a way to enhancer this code?

Something like this? clear all; %get rid of everything in memory close all; %close all open figures %X axis Test_Cases = { '...

5 dagar ago | 0

| accepted

Answered

How to perform division correctly?

It's not because of division, per se, but because of floating-point arithmetic. No division here: a = 3*0.3; b = 0.9; a ==...

How to perform division correctly?

It's not because of division, per se, but because of floating-point arithmetic. No division here: a = 3*0.3; b = 0.9; a ==...

5 dagar ago | 0

Answered

Delete Output_Fcn in GUI

The outputFcn is for returning a handle to your figure (and additional outputs if you like), so you can call your m-file like th...

Delete Output_Fcn in GUI

The outputFcn is for returning a handle to your figure (and additional outputs if you like), so you can call your m-file like th...

5 dagar ago | 0

| accepted

Answered

How to draw voronoi diagram population of country(Numerical one axis data) with name of country with Excel data.

Voronoi diagram is 2D. I don't know where you're going to get a second numeric axis. Using an index isn't very interesting. vor...

How to draw voronoi diagram population of country(Numerical one axis data) with name of country with Excel data.

Voronoi diagram is 2D. I don't know where you're going to get a second numeric axis. Using an index isn't very interesting. vor...

5 dagar ago | 0

| accepted

Answered

plotting a 2D line plot using data with 3 variables

Is something like this what you want to do? % 100 depth values: depth = 100:199; % 14 sediment diameter values: diameter = l...

plotting a 2D line plot using data with 3 variables

Is something like this what you want to do? % 100 depth values: depth = 100:199; % 14 sediment diameter values: diameter = l...

5 dagar ago | 0

Answered

Error using reshape function when trying to split columns into equally sized columns in new cell array

The N's are not being calculated correctly, because this line is incorrect: N = block_size*ceil(numel(participants{j},1)/block_...

Error using reshape function when trying to split columns into equally sized columns in new cell array

The N's are not being calculated correctly, because this line is incorrect: N = block_size*ceil(numel(participants{j},1)/block_...

5 dagar ago | 1

| accepted

Answered

How to find the mode of an array?

One thing you can do is set your inner loop ('b' loop) to start at the index one after the current value of a. This way you neve...

How to find the mode of an array?

One thing you can do is set your inner loop ('b' loop) to start at the index one after the current value of a. This way you neve...

6 dagar ago | 0

| accepted

Answered

Organize the logic to transform given matrix into required

A = [1 5 4 5 7; 2 5 5 5 8; 3 5 6 5 9] B = A.'; % transpose B = B(1:2:end,:) % take every alternate row, starting with 1st Or:...

Organize the logic to transform given matrix into required

A = [1 5 4 5 7; 2 5 5 5 8; 3 5 6 5 9] B = A.'; % transpose B = B(1:2:end,:) % take every alternate row, starting with 1st Or:...

6 dagar ago | 0

| accepted

Answered

How to extract data for some particular region from 1 dimenational satellite data (spatial)

load('sat_data.mat') whos() w idx = inpolygon(lon,lat,w.X,w.Y); scatter3(lon(idx),lat(idx),xch4(idx))

How to extract data for some particular region from 1 dimenational satellite data (spatial)

load('sat_data.mat') whos() w idx = inpolygon(lon,lat,w.X,w.Y); scatter3(lon(idx),lat(idx),xch4(idx))

6 dagar ago | 0

| accepted

Answered

Organize the logic to transform given matrix into required:

A = reshape(1:9,3,[]).' B = triu(A); B(1:size(A,1)+1:end) = -1

Organize the logic to transform given matrix into required:

A = reshape(1:9,3,[]).' B = triu(A); B(1:size(A,1)+1:end) = -1

6 dagar ago | 0

| accepted

Answered

Replacing text with value

A1 = 'A':'O' A2 = 1:15 r = 'AE'; [~,idx] = ismember(r,A1); s = A2(idx)

Replacing text with value

A1 = 'A':'O' A2 = 1:15 r = 'AE'; [~,idx] = ismember(r,A1); s = A2(idx)

6 dagar ago | 0

| accepted

Answered

can deployed application run the 'run' function?

Unfortunately, run() is not supported in deployed applications. <https://www.mathworks.com/help/compiler/unsupported-function...

can deployed application run the 'run' function?

Unfortunately, run() is not supported in deployed applications. <https://www.mathworks.com/help/compiler/unsupported-function...

6 dagar ago | 0

| accepted

Answered

How to write struct back to h5 file

This is a partial answer, at best. But here's how you can modify the 'index' member of the 'table' dataset in that .h5 file, und...

How to write struct back to h5 file

This is a partial answer, at best. But here's how you can modify the 'index' member of the 'table' dataset in that .h5 file, und...

6 dagar ago | 0

| accepted

Answered

How to quickly "plug in" numerical values into symbolic equations to get a numerical result

You can use subs() to do that. It will evaluate yt1 and give you a symbolic value, on which you can use double() to convert to a...

How to quickly "plug in" numerical values into symbolic equations to get a numerical result

You can use subs() to do that. It will evaluate yt1 and give you a symbolic value, on which you can use double() to convert to a...

6 dagar ago | 0

| accepted

Answered

I want to create a matrix combining 2 matrices. The new one must have from the diagonal up de elements of matrix A and from the diagonal down the elements of matrix B. Help

You can use triu() and tril() to get upper- and lower-triangular matrices, respectively, and logical indexing to combine them: ...

I want to create a matrix combining 2 matrices. The new one must have from the diagonal up de elements of matrix A and from the diagonal down the elements of matrix B. Help

You can use triu() and tril() to get upper- and lower-triangular matrices, respectively, and logical indexing to combine them: ...

6 dagar ago | 1

| accepted

Answered

Why my arithmetic function not working ?

From the documentation for im2double(): "im2double rescales the output from integer data types to the range [0, 1]." So if your...

Why my arithmetic function not working ?

From the documentation for im2double(): "im2double rescales the output from integer data types to the range [0, 1]." So if your...

6 dagar ago | 0

Answered

How can I rewrite this in a simple short code

EA = abs([1 (MID(2:end)-MID(1:end-1))./MID(2:end)].');

How can I rewrite this in a simple short code

EA = abs([1 (MID(2:end)-MID(1:end-1))./MID(2:end)].');

7 dagar ago | 2

| accepted

Answered

How i can convert from hex numbers to charter ?

hexStr = ['12';'A6';'36';'36';'F6';'04';'EA';'F6';'4E';'36';'26']; char(bin2dec(fliplr(dec2bin(hex2dec(hexStr),8)))).'

How i can convert from hex numbers to charter ?

hexStr = ['12';'A6';'36';'36';'F6';'04';'EA';'F6';'4E';'36';'26']; char(bin2dec(fliplr(dec2bin(hex2dec(hexStr),8)))).'

7 dagar ago | 1

Answered

Preallocate array of unknown size within cell

One thing you might try is to make posReferences a matrix of size numel(eventPositions) by r, so that it is pre-allocated to hav...

Preallocate array of unknown size within cell

One thing you might try is to make posReferences a matrix of size numel(eventPositions) by r, so that it is pre-allocated to hav...

7 dagar ago | 1

Answered

I am getting this error "The right and left hand sides must have the same number of elements" while computing g(i)

Try replacing this line: g(i) = abs(real(v_ref - vc_k1)) + abs(imag(v_ref - vc_k1)); with this line: g(:,i) = abs(real(v_ref(...

I am getting this error "The right and left hand sides must have the same number of elements" while computing g(i)

Try replacing this line: g(i) = abs(real(v_ref - vc_k1)) + abs(imag(v_ref - vc_k1)); with this line: g(:,i) = abs(real(v_ref(...

7 dagar ago | 0

Answered

How to save a value from a slider

One thing to note is that plotButtonPushed() is nested inside changeThreshold(), so the main function buttonPlot() will not see ...

How to save a value from a slider

One thing to note is that plotButtonPushed() is nested inside changeThreshold(), so the main function buttonPlot() will not see ...

7 dagar ago | 0

Answered

Select lines from table to plot in MATLAB GUI

You can create one line for each spectrum (this would probably be in the plot button Callback) and then set the visibility of th...

Select lines from table to plot in MATLAB GUI

You can create one line for each spectrum (this would probably be in the plot button Callback) and then set the visibility of th...

7 dagar ago | 0

| accepted

Answered

Save multiple columns of multiple csv files?

[file_list, path_n] = uigetfile('.csv', 'Grab csv', 'Multiselect', 'on'); if ~iscell(file_list) file_list = {file_list}; ...

Save multiple columns of multiple csv files?

[file_list, path_n] = uigetfile('.csv', 'Grab csv', 'Multiselect', 'on'); if ~iscell(file_list) file_list = {file_list}; ...

8 dagar ago | 0

| accepted

Answered

Setting section = NaN deletes part of matrix

Change this: bath_50m(ilon, ilat) = NaN; to this: bath_50m(ilat, ilon) = NaN; The reason is because this happened: bath_ch...

Setting section = NaN deletes part of matrix

Change this: bath_50m(ilon, ilat) = NaN; to this: bath_50m(ilat, ilon) = NaN; The reason is because this happened: bath_ch...

8 dagar ago | 0

| accepted

Answered

How to plot overlapped graphs better?

Maybe make top line dotted: figure(3) plot(t,mu_true,"b-"); hold on plot(t,mu_predicted , "r:"); xlabel('t'); ylabel('result...

How to plot overlapped graphs better?

Maybe make top line dotted: figure(3) plot(t,mu_true,"b-"); hold on plot(t,mu_predicted , "r:"); xlabel('t'); ylabel('result...

8 dagar ago | 0

Answered

Trouble using strings in If statements using OR

if race == "H2" || race == "H1" || race == "H3" || race == "H4"

Trouble using strings in If statements using OR

if race == "H2" || race == "H1" || race == "H3" || race == "H4"

8 dagar ago | 0

| accepted

Answered

I need to read an array to see if it has repeated elements (using for loop)

You can do it with two for loops like that, but note that if an element occurs more than two times, each pair will be counted, e...

I need to read an array to see if it has repeated elements (using for loop)

You can do it with two for loops like that, but note that if an element occurs more than two times, each pair will be counted, e...

8 dagar ago | 1