回答済み

Requirements for load() argument

The variable fullpath is a string already. When you use 'fullpath' in quotes, that's passing the string "fullpath" to load. Remo...

Requirements for load() argument

The variable fullpath is a string already. When you use 'fullpath' in quotes, that's passing the string "fullpath" to load. Remo...

3ヶ月 前 | 0

| 採用済み

回答済み

I have a text file with 10 lines and 5 columns. I need to write a value (zero or one) at the end of each row, that is, in the last column of each row. How can i do this?

dlmwrite is deprecated, though you could use it in a similar fashion as below: fname = 'filename.txt'; outname = 'out.txt'; M...

I have a text file with 10 lines and 5 columns. I need to write a value (zero or one) at the end of each row, that is, in the last column of each row. How can i do this?

dlmwrite is deprecated, though you could use it in a similar fashion as below: fname = 'filename.txt'; outname = 'out.txt'; M...

3ヶ月 前 | 0

回答済み

How to skip years with no data when reading the data from a website

You could use continue to move to the next iteration of the for loop.

How to skip years with no data when reading the data from a website

You could use continue to move to the next iteration of the for loop.

3ヶ月 前 | 0

| 採用済み

回答済み

DES implementation in MATLAB faacing error in performing XOR operation

a and b apparently do not have the same number of characters. You can confirm this by displaying their sizes: size(a) size(b) ...

DES implementation in MATLAB faacing error in performing XOR operation

a and b apparently do not have the same number of characters. You can confirm this by displaying their sizes: size(a) size(b) ...

3ヶ月 前 | 0

回答済み

Is there a way to find the x & y intercepts and give it a label?

[~, idx] = min(abs(H_system_Open-pump_curve)); plot(Q(idx), pump_curve(idx),'k*') text(Q(idx),pump_curve(idx),'Label') If you...

Is there a way to find the x & y intercepts and give it a label?

[~, idx] = min(abs(H_system_Open-pump_curve)); plot(Q(idx), pump_curve(idx),'k*') text(Q(idx),pump_curve(idx),'Label') If you...

4ヶ月 前 | 0

回答済み

splitting range of rows in separate column

A = readmatrix('filename.xlsx'); len = size(A,1); % Make sure array length is divisible by 17. B = padarray(A,[17-mod(len,17)...

splitting range of rows in separate column

A = readmatrix('filename.xlsx'); len = size(A,1); % Make sure array length is divisible by 17. B = padarray(A,[17-mod(len,17)...

4ヶ月 前 | 0

| 採用済み

回答済み

Data extraction after parallel computing

To debug a parfor loop, first remove the par and try to run it as a normal loop. It's possible something in your funcList is no...

Data extraction after parallel computing

To debug a parfor loop, first remove the par and try to run it as a normal loop. It's possible something in your funcList is no...

4ヶ月 前 | 0

回答済み

Plotting a legend without displaying data on UIAxes

colororder = {'r','g','b','c','m'}; x = rand(100,5); label = cellstr(num2str([1:1:size(x,2)]', 'cluster%d')); % Plot a p...

Plotting a legend without displaying data on UIAxes

colororder = {'r','g','b','c','m'}; x = rand(100,5); label = cellstr(num2str([1:1:size(x,2)]', 'cluster%d')); % Plot a p...

4ヶ月 前 | 0

| 採用済み

回答済み

rename single .txt file with changing seed number

Do you know the seed? testSeed = 454; NewTest = strcat('C:\Users\PC\Desktop\TestData', num2str(testSeed), '.txt') If you want...

rename single .txt file with changing seed number

Do you know the seed? testSeed = 454; NewTest = strcat('C:\Users\PC\Desktop\TestData', num2str(testSeed), '.txt') If you want...

5ヶ月 前 | 1

| 採用済み

回答済み

How to export sub/nested structures using writestruct?

If you want to write to a single output file, writestruct() already supports nested structs containing scalar or vector values. ...

How to export sub/nested structures using writestruct?

If you want to write to a single output file, writestruct() already supports nested structs containing scalar or vector values. ...

5ヶ月 前 | 0

| 採用済み

回答済み

How to export sub/nested structures using writestruct?

In step 3, you are trying to do an rmfield operation on a string array (rmfield is for structs only). If you want to remove the ...

How to export sub/nested structures using writestruct?

In step 3, you are trying to do an rmfield operation on a string array (rmfield is for structs only). If you want to remove the ...

5ヶ月 前 | 0

回答済み

underwater acoustic wave Signal to Noise Ratio (SNR)

Your individual noise sources add up to a decreasing signal, and I'm not sure af is on the right scale. Should S in the noise e...

underwater acoustic wave Signal to Noise Ratio (SNR)

Your individual noise sources add up to a decreasing signal, and I'm not sure af is on the right scale. Should S in the noise e...

5ヶ月 前 | 1

回答済み

How to avoid rounding error

Matlab is simply truncating the displayed value for ease of reading. format longG sqrt(10001) In both cases, the actual value...

How to avoid rounding error

Matlab is simply truncating the displayed value for ease of reading. format longG sqrt(10001) In both cases, the actual value...

5ヶ月 前 | 0

| 採用済み

回答済み

I keep getting this error...

In your workspace, does a already exist, or some other arduino object? if so, type clear a (or the other relevant object) in ...

I keep getting this error...

In your workspace, does a already exist, or some other arduino object? if so, type clear a (or the other relevant object) in ...

5ヶ月 前 | 1

回答済み

Graph gives warning : function behaves unexpectedly on array inputs. What does this mean?

You are using matrix (linear algebra) operators, which include * and ^. If you try to calculate the function directly, You get a...

Graph gives warning : function behaves unexpectedly on array inputs. What does this mean?

You are using matrix (linear algebra) operators, which include * and ^. If you try to calculate the function directly, You get a...

5ヶ月 前 | 1

| 採用済み

回答済み

Creating a struct with means and standard deviations

It looks like you want an array of structs. Use strings or uint64 for the IDs S = struct('id',uint64(123456),'mean',rand(3),'st...

Creating a struct with means and standard deviations

It looks like you want an array of structs. Use strings or uint64 for the IDs S = struct('id',uint64(123456),'mean',rand(3),'st...

5ヶ月 前 | 0

| 採用済み

回答済み

How to make specific elements of a cell equal to zero?

If there's a single value in each cell, you could first convert to a matrix. A = num2cell(rand(3)) Amat = cell2mat(A); Amat...

How to make specific elements of a cell equal to zero?

If there's a single value in each cell, you could first convert to a matrix. A = num2cell(rand(3)) Amat = cell2mat(A); Amat...

5ヶ月 前 | 0

| 採用済み

回答済み

I want to draw a scatterplot but there's a problem about range of color

To specify a custom range, you can use a pre-defined RGB colormap (replace 6 with 101 or whatever is appropriate) c1 = parula(6...

I want to draw a scatterplot but there's a problem about range of color

To specify a custom range, you can use a pre-defined RGB colormap (replace 6 with 101 or whatever is appropriate) c1 = parula(6...

5ヶ月 前 | 0

| 採用済み

回答済み

For loop error, not getting desired output

At the end of the inner for loop, you set all_correct(columns,1) = correct; Columns == 3 forever, and correct == 4 by that poi...

For loop error, not getting desired output

At the end of the inner for loop, you set all_correct(columns,1) = correct; Columns == 3 forever, and correct == 4 by that poi...

5ヶ月 前 | 0

| 採用済み

回答済み

Swapping of data points

The hopping happens because the output of roots() isn't sorted in a way that is useful for this script. Further, when you use s...

Swapping of data points

The hopping happens because the output of roots() isn't sorted in a way that is useful for this script. Further, when you use s...

5ヶ月 前 | 1

回答済み

pdeplot3d "value of 'colormapdata' is invalid" or "Length of colormapdata vector must equal number of nodes."

I'm not familiar with this toolbox, but... You have a 3D model, but only 2D flux. [qx,qy,qz] = evaluateHeatFlux(thermalresults...

pdeplot3d "value of 'colormapdata' is invalid" or "Length of colormapdata vector must equal number of nodes."

I'm not familiar with this toolbox, but... You have a 3D model, but only 2D flux. [qx,qy,qz] = evaluateHeatFlux(thermalresults...

5ヶ月 前 | 0

| 採用済み

回答済み

How to sum two gaussian curve fits (cfit) ?

You could evaluate the fits and add them, though they would no longer be cfits. x = linspace(20,35); F1pts = feval(F1,x); F2p...

How to sum two gaussian curve fits (cfit) ?

You could evaluate the fits and add them, though they would no longer be cfits. x = linspace(20,35); F1pts = feval(F1,x); F2p...

8ヶ月 前 | 1

| 採用済み

回答済み

how to work with text files?

fopen is for low-level file operations you may not need. Perhaps try data = importdata('stud_ex.txt') Which will give you a s...

how to work with text files?

fopen is for low-level file operations you may not need. Perhaps try data = importdata('stud_ex.txt') Which will give you a s...

8ヶ月 前 | 0

| 採用済み

回答済み

why is this Matlab Code faster than the C++ code below? I want to understand what Matlab internally does better and faster than C++

I see an efficiency in primes.counter = primes.counter - 1; Matlab uses LAPACK for matrix/vector operations, which I think sho...

why is this Matlab Code faster than the C++ code below? I want to understand what Matlab internally does better and faster than C++

I see an efficiency in primes.counter = primes.counter - 1; Matlab uses LAPACK for matrix/vector operations, which I think sho...

8ヶ月 前 | 1

| 採用済み

回答済み

Changing numbers in dataset

For only five values, I think it's pretty efficient to do a direct replacement: ds_new = zeros(size(dataset)) ds_new(dataset =...

Changing numbers in dataset

For only five values, I think it's pretty efficient to do a direct replacement: ds_new = zeros(size(dataset)) ds_new(dataset =...

8ヶ月 前 | 1

回答済み

Where is the error in my code?

The colon operator has a default spacing of 1. r = 0:0.07 gives: 0, % next value... 1 > 0.07 % so r = [0] Use an intermedi...

Where is the error in my code?

The colon operator has a default spacing of 1. r = 0:0.07 gives: 0, % next value... 1 > 0.07 % so r = [0] Use an intermedi...

8ヶ月 前 | 0

回答済み

Issues updating vector inside a for loop

When find doesn't find any values > 0.999, it returns an empty vector, with a size of 0x1. Furthermore, max returns an empty vec...

Issues updating vector inside a for loop

When find doesn't find any values > 0.999, it returns an empty vector, with a size of 0x1. Furthermore, max returns an empty vec...

8ヶ月 前 | 0

| 採用済み

回答済み

Increasing Edge Lines in a Surface Plot

sf = fit([x,u],z,'poly15','normalize','on'); xpts = linspace(min(x),max(x),100); upts = linspace(min(u),max(u),100); [xx, uu]...

Increasing Edge Lines in a Surface Plot

sf = fit([x,u],z,'poly15','normalize','on'); xpts = linspace(min(x),max(x),100); upts = linspace(min(u),max(u),100); [xx, uu]...

8ヶ月 前 | 0

| 採用済み

質問

Is there a good reason for choosing assert() over an if condition with an error?

I want to make sure a condition is valid, so I write a quick test for it with a boolean output. Does it matter whether I put the...

9ヶ月 前 | 1 件の回答 | 1