답변 있음
Add field to a double array?
My best guess is that someone is trying to restructure *obj.mu* that had a double array into one that has two fields instead. It...

8년 초과 전 | 0

답변 있음
Uniformly Distribute numbers on for loop?
Here's the vectorized form: rng(0, 'Twister'); a = -1; b = 3; x = randi([a, b], 100, 1); y = (x.^3) - sin(...

8년 초과 전 | 1

| 수락됨

답변 있음
How to get values from an array using another logical array
Instead of A(B) try A.*B

8년 초과 전 | 2

| 수락됨

답변 있음
Compare and compile matching values from various data set.
First, do not label variables dynmically like data1, data2, data3, etc.. as this will make your function very complicated. In yo...

8년 초과 전 | 0

| 수락됨

답변 있음
Error due to using the same varname in mat file and matlab function
Try to load the variables into a structure to prevent "poofing" them into your workspace, which can cause issues with overriding...

8년 초과 전 | 1

| 수락됨

답변 있음
Remove elements of a cell array if length<200
Y = Y(cellfun(@(x) length(x) >= 200, Y))

8년 초과 전 | 0

| 수락됨

답변 있음
How can I get the RGB values separately for an image taken using a webcam?
R = 255, G = 255, B = 255 is the RGB color for white when the data is in uint8 format( 0 - 255 ) values. The website below shows...

8년 초과 전 | 0

답변 있음
What is wrong with this code?
Here are some other comments about the code to help with readability, etc: Function dcm = dcm2vol(din) %<-- "function" mus...

8년 초과 전 | 2

| 수락됨

답변 있음
loadind data loop fastly?
Not sure if this is faster or not, but your code could be simplified a lot. If you have parallel computing toolbox, you could di...

8년 초과 전 | 0

| 수락됨

답변 있음
How to use find when some of the searches will not return a result?
A is a Mx3 matrix, but you are trying to access A as a MxNx3 matrix, ex: A( A(:,1)==Y(i,j), A(:,2)==X(i,j), 3) %A is not ...

8년 초과 전 | 0

| 수락됨

답변 있음
I have 12 matrices of 145x1.how to get 1740x1 matrix taking each values from the columns first
%======================================================================== %If you labeled your variables inconveniently lik...

8년 초과 전 | 0

답변 있음
Error when using isempty in a while loop
One issue you'll find is that the |input| will error out for number inputs such as: "1 2 3 4". If you only want string inputs, u...

8년 초과 전 | 0

답변 있음
How to change the style of the plot box outline without affecting axis style?
I can't seem to find a way to change the axes line color individually... Workaround would be to draw 3 axes and adjust the line ...

8년 초과 전 | 1

| 수락됨

답변 있음
Why is compiled parfor repeatedly trying to start a parallel pool?
Your compiled application (which is pre 2016a) has access to parallel processing and will use the default parallel setting, whic...

8년 초과 전 | 0

답변 있음
How can I replicate elements of a vector of into another
v2 = [1 1 1 1 3 1 4]; vx = cellfun(@(x) repmat(x, 1, x), num2cell(v2), 'uniformoutput', false); v3 = [vx{:}]; v3 = ...

8년 초과 전 | 0

답변 있음
Mirror x-axis of Image but not the x-axis of the plot over top of it?
Try flipping the data stored in |im| instead of the x/y axes direction. im.CData = flipud(im.CData) %To flip image across...

8년 초과 전 | 0

| 수락됨

답변 있음
How to display the elements of a matrix D as an input for the next matrix 729x729 rows and columns?
Maybe you can make your own data structure and get/set methods to access them by 6-tuple char: Tuple = fullfact([3 3 3 3 3 ...

8년 초과 전 | 0

답변 있음
Problems with the function plot
NEW ANSWER Somehow, setting to opengl renderer after Matlab starts causes an issue. I could replicate the bug if I do |op...

8년 초과 전 | 3

| 수락됨

답변 있음
using textscan to separate columns by delimiter
Here's how to open a file separated by space. See example data.txt. FID = fopen(FileName, 'r'); %Open file to read, save th...

8년 초과 전 | 0

답변 있음
Why does my image keep disappearing from my GUI when I try to create a free hand mask?
NEW ANSWER For some reason, your gui is not saving the "crackdetection" variable prior to the Masking callback function. Your...

8년 초과 전 | 1

답변 있음
How can I convert matrix to cell array of strings?
You could use |sprintf|. mat = [1 2 3; 4 5 6 ; 7 8 9]; arr = cell(1, size(mat, 1)); for k = 1:numel(arr) arr{k}...

8년 초과 전 | 1

| 수락됨

답변 있음
Create 58 graphs as a waterfall plot from 58 .csv files
You should use plot3 instead of plot to draw line in 3D. More info here: <https://www.mathworks.com/help/matlab/ref/plot3.htm...

8년 초과 전 | 1

| 수락됨

답변 있음
Adding the elements of a field of a struct
To fix this, transpose column vector to row like this: output(activityNum).distanceininches = zDistance(startind:endind).';...

8년 초과 전 | 0

답변 있음
transparent background for scatter plot
imagesc will use the colormap of the figure, so if you want to use a different color scheme for scatter, calculate out the rgb v...

8년 초과 전 | 0

답변 있음
How do I store larger and smaller values in a matrix?
I'm guessing this is what you see: denum = 1.0e+014 * 0.0000 0.0000 1.0000 0.0000 0.0000 1.0...

8년 초과 전 | 0

| 수락됨

답변 있음
why do I have this error in index
You are accessing a matrix using a non-integer index right here, which is not allowed. Index must be an integer > 0. Another iss...

8년 초과 전 | 0

답변 있음
Loop for this program
Looks like |d| is a vector. You can use a logical array |( d < 27 )| to find where in |d| is under 27, and then use this logical...

8년 초과 전 | 0

답변 있음
Can anyone help in explaining how the below code is detecting rain streaks???
clc % clear command window clear all % clear all variables close all % close all figures I=imread('heavyrain.jpg...

8년 초과 전 | 0

답변 있음
For Loop Output as a Vector
a = [0; 1; 0; -1]; p4 = zeros(1, 601); z = linspace(-3,3,601); %leave z as a matrix, instead of using it as a for loop co...

8년 초과 전 | 0

답변 있음
Each time I write my code I get this error 'Subscript indices must either be real positive integers or logicals.'
The issue is you are accessing a matrix using a non-integer index. That's not allowed in MATLAB. t = 0:0.05:40 %this is n...

8년 초과 전 | 0

| 수락됨

더 보기