Respondida
Hello everyone.How to modify the judgment code below and add'This is correct' and'This is wrong'?
As mlint is already warning you: 0.125<lamda1<3 is not doing what you think it does. Use this instead: if 0.125<lamda1 && lambd...

más de 5 años hace | 0

Respondida
How can i plot it
You have two surfaces: theta = linspace(0,2*pi,30); phi = linspace(0,pi/2,30); [theta,phi] = meshgrid(theta,phi); r = 3; ...

más de 5 años hace | 0

| aceptada

Respondida
How to get data from a website
I can't tell you what you did wrong, because you decided not to post what you have tried. That meant I had to write your code fr...

más de 5 años hace | 0

| aceptada

Respondida
Build a relay on code
You should sketch the two behaviors (don't use i or j as a variable name, and use comments to describe what your code is doing):...

más de 5 años hace | 0

| aceptada

Respondida
How to randomly select sub-sets from an array?
Read your data to a Matlab variable (even load might work here). Generate a vector of 1000 integers between 1 and 51360-48. The...

más de 5 años hace | 0

Respondida
Why is extractFileText Much Slower than fileread for Text Files?
fileread is very basic. It will often not work for files that are encoded with UTF-8 and can only handle plain text files. That ...

más de 5 años hace | 0

| aceptada

Respondida
WebAPP Server 2020b File download using uiputfile
The uiputfile returns a full path as the second output, see the documentation. You can test if the path it returns fits within y...

más de 5 años hace | 0

Respondida
R code to MatLab?
The consensus seems to be that you should invoke R from the command line. You can use the RunRcode FEX submission.

más de 5 años hace | 0

Respondida
How can I add a legend in a for loop?
The best way is probably to use the DisplayName input for plot. You would have to be a bit careful about the order in which your...

más de 5 años hace | 0

| aceptada

Respondida
Change multiple push buttons with one push button?
You can make the shift callback change a flag. That flag should be stored in the guidata struct. In the other callbacks you can ...

más de 5 años hace | 1

| aceptada

Respondida
Implement double summation in Matlab
The sigma symbol contains all syntactic elements that you need for a for loop: y=0;%initialize to 0 for j=1:N for i=1:j...

más de 5 años hace | 0

Respondida
Replace values in a matrix
Because you are only using integers, you can even use indexing to do the replacement: A=[NaN NaN NaN 3 3 3 2 NaN...

más de 5 años hace | 0

| aceptada

Respondida
Save workspace with same load file name
You can use code like this in a loop. file_name_including_dot_txt='example.txt'; data=function_that_reads_your_file(file_name_...

más de 5 años hace | 2

| aceptada

Respondida
define end of line (eol) as unix (\n) not Windows (\r\n) using writecell
You can hack a solution together: Write the file with CRLF with writecell Read the file as a text file (e.g. with readfile or ...

más de 5 años hace | 1

Respondida
fopen files in one dataset
You don't use either filename when calling fopen. How is Matlab supposed to know which file you mean? I would suggest using eit...

más de 5 años hace | 0

| aceptada

Respondida
Iterating through a structure
You can index a struct in a loop: rx = no_afr_stru(n).X(1:end-1); ry = no_afr_stru(n).Y(1:end-1);

más de 5 años hace | 0

| aceptada

Respondida
Randomized array with limits
A=1:3;A(4)=randi(3); mp=A(randperm(end))

más de 5 años hace | 0

Respondida
Converting data from two cell arrays in one vector
Je zou je klasgenoot kunnen vragen, ik heb gisteren bijna de zelfde vraag beantwoord: link. Continuing in English: that shoul...

más de 5 años hace | 0

Respondida
Sort categorical variables in an alphabetical order
As Ive Ive suggested: the sort function will do what you need: B = categorical({'NY','Boston'}); sort(B)

más de 5 años hace | 0

| aceptada

Respondida
A neat reliable way to add up section of a matrix
Loops tend to do the trick: A = repmat(1:10,10,1); B = repmat(1:8,10,1); C = repmat(1:6,10,1); D = repmat(1:4,10,1); E = re...

más de 5 años hace | 1

| aceptada

Respondida
Take maximum of different cell arrays in cell array
In each cell there is a double, and some elements are empty. You can either use a loop or use cellfun. B=cellfun(@max,d...

más de 5 años hace | 0

| aceptada

Respondida
Read a list of filenames in a text file
If you are using R2020b you can use the readlines function to read the content of a file to a string array. You can also get the...

más de 5 años hace | 1

| aceptada

Respondida
Warning: Name is nonexistent or not a directory error
I have seen the suggestion to use the 'set path' window to remove the temporary folder from the path. That worked for me. In th...

más de 5 años hace | 1

| aceptada

Respondida
how to speed up basic image processing tasks
Most basic tasks can be vectorized. But for your code there is something that makes an even larger difference: you don't have a ...

más de 5 años hace | 1

| aceptada

Respondida
how to solve (5x1) matrix?
I believe I can mimic the shortest answer I have seen on this forum: \ To give this answer a bit more substance: you need to...

más de 5 años hace | 0

| aceptada

Respondida
How to change figure properties for all figures in MATLAB?
set(groot,'defaultFigureCreateFcn',@(fig,~)SomeFunction(fig))

más de 5 años hace | 0

Respondida
How to read greek characters in a .txt file
You can get my readfile function from the FEX. If you are using R2017a or later, you can also get it through the AddOn-manager.

más de 5 años hace | 0

Respondida
MATLAB taking too much memory on SD card
I'm guessing you have a fairly large sector size on your SD card. Most file systems store files in sections called sectors. If ...

más de 5 años hace | 0

| aceptada

Respondida
end indexing function as method input
If you create a dummy property (which is only used so Matlab treats your method as a property), you can use the overloaded subsr...

más de 5 años hace | 0

| aceptada

Respondida
Error in hand written code
I personally prefer not to use load for text files, as it isn't obvious from the context that the specific text file will actual...

más de 5 años hace | 0

Cargar más